]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
dc.c:use kzalloc without test
authorzhongshiqi <zhong.shiqi@zte.com.cn>
Wed, 23 Oct 2019 08:32:23 +0000 (16:32 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 30 Oct 2019 15:56:16 +0000 (11:56 -0400)
dc.c:583:null check is needed after using kzalloc function

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: zhongshiqi <zhong.shiqi@zte.com.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c

index 5d1adeda4d90fa189bfa5dc36bea2bdce30cf72a..4b8819c27fcda3a3011e58f2a5de081cd8ccd25d 100644 (file)
@@ -580,6 +580,10 @@ static bool construct(struct dc *dc,
 #ifdef CONFIG_DRM_AMD_DC_DCN2_0
        // Allocate memory for the vm_helper
        dc->vm_helper = kzalloc(sizeof(struct vm_helper), GFP_KERNEL);
+       if (!dc->vm_helper) {
+               dm_error("%s: failed to create dc->vm_helper\n", __func__);
+               goto fail;
+       }
 
 #endif
        memcpy(&dc->bb_overrides, &init_params->bb_overrides, sizeof(dc->bb_overrides));