<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#008000;margin:15pt;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></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> Das, Nirmoy <Nirmoy.Das@amd.com><br>
<b>Sent:</b> Thursday, May 27, 2021 8:16 AM<br>
<b>To:</b> Wentland, Harry <Harry.Wentland@amd.com><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> RE: [PATCH 1/1] drm/amd/display: WARN_ON cleanups</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">[AMD Official Use Only]<br>
<br>
s/Uuse/use<br>
<br>
-----Original Message-----<br>
From: Das, Nirmoy <Nirmoy.Das@amd.com> <br>
Sent: Thursday, May 27, 2021 2:15 PM<br>
To: Wentland, Harry <Harry.Wentland@amd.com><br>
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; amd-gfx@lists.freedesktop.org; Das, Nirmoy <Nirmoy.Das@amd.com><br>
Subject: [PATCH 1/1] drm/amd/display: WARN_ON cleanups<br>
<br>
Uuse WARN_ON() inside if-condition when possible.<br>
<br>
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com><br>
---<br>
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++-------<br>
 1 file changed, 4 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
index f2ed51484980..736eb537a8e4 100644<br>
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
@@ -315,8 +315,7 @@ get_crtc_by_otg_inst(struct amdgpu_device *adev,<br>
         struct drm_crtc *crtc;<br>
         struct amdgpu_crtc *amdgpu_crtc;<br>
 <br>
-       if (otg_inst == -1) {<br>
-               WARN_ON(1);<br>
+       if (WARN_ON(otg_inst == -1)) {<br>
                 return adev->mode_info.crtcs[0];<br>
         }<br>
 <br>
@@ -397,8 +396,7 @@ static void dm_pflip_high_irq(void *interrupt_params)<br>
         e = amdgpu_crtc->event;<br>
         amdgpu_crtc->event = NULL;<br>
 <br>
-       if (!e)<br>
-               WARN_ON(1);<br>
+       WARN_ON(!e);<br>
 <br>
         vrr_active = amdgpu_dm_vrr_active_irq(amdgpu_crtc);<br>
 <br>
@@ -6698,9 +6696,8 @@ static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc,<br>
 <br>
         dm_update_crtc_active_planes(crtc, crtc_state);<br>
 <br>
-       if (unlikely(!dm_crtc_state->stream &&<br>
-                    modeset_required(crtc_state, NULL, dm_crtc_state->stream))) {<br>
-               WARN_ON(1);<br>
+       if (WARN_ON(unlikely(!dm_crtc_state->stream &&<br>
+                    modeset_required(crtc_state, NULL, dm_crtc_state->stream)))) {<br>
                 return ret;<br>
         }<br>
 <br>
-- <br>
2.31.1<br>
</div>
</span></font></div>
</div>
</body>
</html>