Skip to contentSkip to conversation

drm/amd/display: WARN_ON cleanups

PATCH In review Nirmoy Das 3 participants 5 messages May 27, 2021 – May 28, 2021

Subsystems (3)
lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

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

Uuse WARN_ON() inside if-condition when possible.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -7
index f2ed51484980..736eb537a8e4 100644
@@ -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;
 	}
 
Signature · 6 lines
2.31.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

[AMD Official Use Only]

s/Uuse/use

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

Uuse WARN_ON() inside if-condition when possible.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -7
index f2ed51484980..736eb537a8e4 100644
@@ -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;
 	}
 
Signature · 5 lines
2.31.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
maintainer Reviewed-by
#2 lore raw

[Public]

________________________________
From: Das, Nirmoy <[email protected]>
Sent: Thursday, May 27, 2021 8:16 AM
To: Wentland, Harry <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected] <[email protected]>
Subject: RE: [PATCH 1/1] drm/amd/display: WARN_ON cleanups

[AMD Official Use Only]

s/Uuse/use

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

Uuse WARN_ON() inside if-condition when possible.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +4 -7
index f2ed51484980..736eb537a8e4 100644
@@ -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

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
In reply to Nirmoy Das

Am 27.05.21 um 14:14 schrieb Nirmoy Das:

Quoted 12 lines

Uuse WARN_ON() inside if-condition when possible.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++-------
  1 file changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index f2ed51484980..736eb537a8e4 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c get_crtc_by_otg_inst(struct amdgpu_device *adev, · line 320

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -2
@@ -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];
  	}

While at it you could also drop the extra {} here.

Apart from that patch is Acked-by: Christian König <[email protected]>.

Christian.

Quoted 13 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -2
@@ -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,
 

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 6703

Quoted 10 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -3
  	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;
  	}
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author Applied
#4 lore raw
Quoted 10 lines · Christian König

Am 27.05.21 um 14:14 schrieb Nirmoy Das:

Quoted 7 lines

Uuse WARN_ON() inside if-condition when possible.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++-------

  1 file changed, 4 insertions(+), 7 deletions(-)
Quoted 14 lines

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c get_crtc_by_otg_inst(struct amdgpu_device *adev, · line 320

Quoted 12 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
index f2ed51484980..736eb537a8e4 100644
@@ -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];
       }

While at it you could also drop the extra {} here.

I merged it this morning :/ I will speak with Alex to clean this up.

Nirmoy

Quoted 24 lines

Apart from that patch is Acked-by: Christian König <[email protected]>.

Christian.

Quoted 18 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -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;
      }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx