<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<p style="font-family:Calibri;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - AMD Internal Distribution Only]<br>
</p>
<br>
<div>
<div dir="auto"><span style="font-family: -apple-system, HelveticaNeue; font-size: 14.6667px; display: inline !important; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">Reviewed-by: Srinivasan Shanmugam <</span><a href="mailto:srinivasan.shanmugam@amd.com" class="ms-outlook-linkify" style="font-family: -apple-system, HelveticaNeue; font-size: 14.6667px; color: rgb(0, 120, 212); background-color: rgb(255, 255, 255);">srinivasan.shanmugam@amd.com</a><span style="font-family: -apple-system, HelveticaNeue; font-size: 14.6667px; display: inline !important; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">></span><br>
</div>
<div><br>
</div>
<div id="ms-outlook-mobile-signature" dir="auto">Get <a href="https://aka.ms/AAb9ysg">
Outlook for Android</a></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> LIPSKI, IVAN <IVAN.LIPSKI@amd.com><br>
<b>Sent:</b> Friday, June 7, 2024 10:03:59 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> SHANMUGAM, SRINIVASAN <SRINIVASAN.SHANMUGAM@amd.com>; Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; Wentland, Harry <Harry.Wentland@amd.com>; Siqueira, Rodrigo <Rodrigo.Siqueira@amd.com>; Choi, Nicholas <Nicholas.Choi@amd.com>; Zhang, George <George.Zhang@amd.com>;
 alex.deucher@amd.com <alex.deucher@amd.com>; LIPSKI, IVAN <IVAN.LIPSKI@amd.com><br>
<b>Subject:</b> [PATCH 2/2] Revert "drm/amd/display: Add NULL check for 'afb' before dereferencing in amdgpu_dm_plane_handle_cursor_update"</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">From: Ivan Lipski <ivlipski@amd.com><br>
<br>
[WHY]<br>
This patch is a dupplicate implementation of 14bcf29b, which we<br>
are reverting due to a regression with kms_plane_cursor IGT tests.<br>
<br>
This reverts commit 0d84450ae0db367780c3dd2e208fe4e6fe5565b8.<br>
<br>
Signed-off-by: Ivan Lipski <ivlipski@amd.com><br>
---<br>
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c  | 16 ++++------------<br>
 1 file changed, 4 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c<br>
index b339642b86c0..a64f20fcddaa 100644<br>
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c<br>
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c<br>
@@ -1246,22 +1246,14 @@ void amdgpu_dm_plane_handle_cursor_update(struct drm_plane *plane,<br>
 {<br>
         struct amdgpu_device *adev = drm_to_adev(plane->dev);<br>
         struct amdgpu_framebuffer *afb = to_amdgpu_framebuffer(plane->state->fb);<br>
-       struct drm_crtc *crtc;<br>
-       struct dm_crtc_state *crtc_state;<br>
-       struct amdgpu_crtc *amdgpu_crtc;<br>
-       u64 address;<br>
+       struct drm_crtc *crtc = afb ? plane->state->crtc : old_plane_state->crtc;<br>
+       struct dm_crtc_state *crtc_state = crtc ? to_dm_crtc_state(crtc->state) : NULL;<br>
+       struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);<br>
+       uint64_t address = afb ? afb->address : 0;<br>
         struct dc_cursor_position position = {0};<br>
         struct dc_cursor_attributes attributes;<br>
         int ret;<br>
 <br>
-       if (!afb)<br>
-               return;<br>
-<br>
-       crtc = plane->state->crtc ? plane->state->crtc : old_plane_state->crtc;<br>
-       crtc_state = crtc ? to_dm_crtc_state(crtc->state) : NULL;<br>
-       amdgpu_crtc = to_amdgpu_crtc(crtc);<br>
-       address = afb->address;<br>
-<br>
         if (!plane->state->fb && !old_plane_state->fb)<br>
                 return;<br>
 <br>
-- <br>
2.34.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>