From: Dan Carpenter Date: Wed, 19 Jun 2019 10:01:41 +0000 (+0300) Subject: drm: self_refresh: Fix a reversed condition in drm_self_refresh_helper_cleanup() X-Git-Tag: v5.4-rc1~32^2~20^2~402 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d0ed30433aa88c94411b6c078a7985a6e7c889f;p=platform%2Fkernel%2Flinux-rpi.git drm: self_refresh: Fix a reversed condition in drm_self_refresh_helper_cleanup() This test is flipped around so it either leads to a memory leak or a NULL dereference. Fixes: 1452c25b0e60 ("drm: Add helpers to kick off self refresh mode in drivers") Signed-off-by: Dan Carpenter Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20190619100141.GA28596@mwanda --- diff --git a/drivers/gpu/drm/drm_self_refresh_helper.c b/drivers/gpu/drm/drm_self_refresh_helper.c index 2b3daaf..e0d2ad1f 100644 --- a/drivers/gpu/drm/drm_self_refresh_helper.c +++ b/drivers/gpu/drm/drm_self_refresh_helper.c @@ -205,7 +205,7 @@ void drm_self_refresh_helper_cleanup(struct drm_crtc *crtc) struct drm_self_refresh_data *sr_data = crtc->self_refresh_data; /* Helper is already uninitialized */ - if (sr_data) + if (!sr_data) return; crtc->self_refresh_data = NULL;