From: Colin Ian King Date: Fri, 26 Apr 2019 21:48:11 +0000 (+0100) Subject: drm/amd/display: fix incorrect null check on pointer X-Git-Tag: v5.4-rc1~971^2~9^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11f874c041f0476ec9fc44387478d3bbb3c74b73;p=platform%2Fkernel%2Flinux-rpi.git drm/amd/display: fix incorrect null check on pointer Currently an allocation is being made but the allocation failure check is being performed on another pointer. Fix this by checking the correct pointer. Also use the normal kernel idiom for null pointer checks. Addresses-Coverity: ("Resource leak") Fixes: 43e3ac8389ef ("drm/amd/display: Add function to copy DC streams") Signed-off-by: Colin Ian King Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c index 6200df3..96e97d2 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c @@ -168,7 +168,7 @@ struct dc_stream_state *dc_copy_stream(const struct dc_stream_state *stream) struct dc_stream_state *new_stream; new_stream = kzalloc(sizeof(struct dc_stream_state), GFP_KERNEL); - if (stream == NULL) + if (!new_stream) return NULL; memcpy(new_stream, stream, sizeof(struct dc_stream_state));