[PATCH 1/1] drm/amd/display: WARN_ON cleanups

Deucher, Alexander Alexander.Deucher at amd.com
Thu May 27 15:06:00 UTC 2021


[Public]

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
________________________________
From: Das, Nirmoy <Nirmoy.Das at amd.com>
Sent: Thursday, May 27, 2021 8:16 AM
To: Wentland, Harry <Harry.Wentland at amd.com>
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>; amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Subject: RE: [PATCH 1/1] drm/amd/display: WARN_ON cleanups

[AMD Official Use Only]

s/Uuse/use

-----Original Message-----
From: Das, Nirmoy <Nirmoy.Das at amd.com>
Sent: Thursday, May 27, 2021 2:15 PM
To: Wentland, Harry <Harry.Wentland at amd.com>
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>; Koenig, Christian <Christian.Koenig at amd.com>; amd-gfx at lists.freedesktop.org; Das, Nirmoy <Nirmoy.Das at amd.com>
Subject: [PATCH 1/1] drm/amd/display: WARN_ON cleanups

Uuse WARN_ON() inside if-condition when possible.

Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

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 f2ed51484980..736eb537a8e4 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -315,8 +315,7 @@ get_crtc_by_otg_inst(struct amdgpu_device *adev,
         struct drm_crtc *crtc;
         struct amdgpu_crtc *amdgpu_crtc;

-       if (otg_inst == -1) {
-               WARN_ON(1);
+       if (WARN_ON(otg_inst == -1)) {
                 return adev->mode_info.crtcs[0];
         }

@@ -397,8 +396,7 @@ static void dm_pflip_high_irq(void *interrupt_params)
         e = amdgpu_crtc->event;
         amdgpu_crtc->event = NULL;

-       if (!e)
-               WARN_ON(1);
+       WARN_ON(!e);

         vrr_active = amdgpu_dm_vrr_active_irq(amdgpu_crtc);

@@ -6698,9 +6696,8 @@ static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc,

         dm_update_crtc_active_planes(crtc, crtc_state);

-       if (unlikely(!dm_crtc_state->stream &&
-                    modeset_required(crtc_state, NULL, dm_crtc_state->stream))) {
-               WARN_ON(1);
+       if (WARN_ON(unlikely(!dm_crtc_state->stream &&
+                    modeset_required(crtc_state, NULL, dm_crtc_state->stream)))) {
                 return ret;
         }

--
2.31.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20210527/42ad9487/attachment.htm>


More information about the amd-gfx mailing list