amd/display: Fix potential null dereference in dce_calcs.c
authorErnst Sjöstrand <ernstp@gmail.com>
Wed, 8 Nov 2017 21:47:06 +0000 (22:47 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 8 Nov 2017 22:30:11 +0000 (17:30 -0500)
Reported by smatch:
bw_calcs() error: potential null dereference 'data'

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Ernst Sjöstrand <ernstp@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c

index 4f8a95368ffcf9b172eda9bbae4958890eef4164..6347712db834b76af9dc8a0069884f8fff64a907 100644 (file)
@@ -2794,6 +2794,8 @@ bool bw_calcs(struct dc_context *ctx,
 {
        struct bw_calcs_data *data = kzalloc(sizeof(struct bw_calcs_data),
                                             GFP_KERNEL);
+       if (!data)
+               return false;
 
        populate_initial_data(pipe, pipe_count, data);