From: Hersen Wu <hersenxs.wu@xxxxxxx> [Why & How] Check return pointer of kzalloc before using it. Reviewed-by: Alex Hung <alex.hung@xxxxxxx> Acked-by: Tom Chung <chiahsuan.chung@xxxxxxx> Signed-off-by: Hersen Wu <hersenxs.wu@xxxxxxx> --- .../gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c index c244262800e1..75e2c62ae792 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c @@ -1273,6 +1273,8 @@ static struct hpo_dp_link_encoder *dcn401_hpo_dp_link_encoder_create( /* allocate HPO link encoder */ hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); + if (!hpo_dp_enc31) + return NULL; /* out of memory */ #undef REG_STRUCT #define REG_STRUCT hpo_dp_link_enc_regs -- 2.34.1