[PATCH] drm/amd/display: fix dereferencing possible ERR_PTR()

Deucher, Alexander Alexander.Deucher at amd.com
Thu Mar 15 13:28:44 UTC 2018


Acked-by: Alex Deucher <alexander.deucher at amd.com>

________________________________
From: S, Shirish
Sent: Thursday, March 15, 2018 6:33:51 AM
To: Deucher, Alexander; Wentland, Harry; amd-gfx at lists.freedesktop.org
Cc: S, Shirish
Subject: [PATCH] drm/amd/display: fix dereferencing possible ERR_PTR()

This patch fixes static checker warning caused by
"36cc549d5986: "drm/amd/display: disable CRTCs with
NULL FB on their primary plane (V2)"

Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Shirish S <shirish.s at amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 0564676..9e2cdc9 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4893,6 +4893,9 @@ static int dm_atomic_check_plane_state_fb(struct drm_atomic_state *state,
                         return -EDEADLK;

                 crtc_state = drm_atomic_get_crtc_state(plane_state->state, crtc);
+               if (IS_ERR(crtc_state))
+                       return PTR_ERR(crtc_state);
+
                 if (crtc->primary == plane && crtc_state->active) {
                         if (!plane_state->fb)
                                 return -EINVAL;
--
2.7.4

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20180315/b41c4ff5/attachment.html>


More information about the amd-gfx mailing list