summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-04-26 22:48:11 +0100
committerAlex Deucher <alexander.deucher@amd.com>2019-04-29 14:56:49 -0500
commit11f874c041f0476ec9fc44387478d3bbb3c74b73 (patch)
treea09b96b85ab56d0aac6f7107074f28754c19ca1f /drivers/gpu/drm
parenta9a3c0da1427153e74a4ad97b1a897384a6b0404 (diff)
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 <colin.king@canonical.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_stream.c2
1 files changed, 1 insertions, 1 deletions
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 6200df3edcd0..96e97d25d639 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));