Skip to contentSkip to conversation

drm/omap: fix misleading indentation in pixinc()

PATCH In review Arnd Bergmann 2 participants 2 messages Mar 22, 2021 – Mar 26, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/omap: fix misleading indentation in pixinc()

From: Arnd Bergmann <[email protected]>

An old patch added a 'return' statement after each BUG() in this driver, which was necessary at the time, but has become redundant after the BUG() definition was updated to handle this properly.

gcc-11 now warns about one such instance, where the 'return' statement was incorrectly indented:

drivers/gpu/drm/omapdrm/dss/dispc.c: In function ‘pixinc’:
drivers/gpu/drm/omapdrm/dss/dispc.c:2093:9: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]

 2093 |         else
      |         ^~~~
drivers/gpu/drm/omapdrm/dss/dispc.c:2095:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
 2095 |                 return 0;
      |                 ^~~~~~

Address this by removing the return again and changing the BUG() to be unconditional to make this more intuitive.

Fixes c6eee968d40d ("OMAPDSS: remove compiler warnings when CONFIG_BUG=n")
---
 drivers/gpu/drm/omapdrm/dss/dispc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +2 -3
index f4cbef8ccace..5619420cc2cc 100644
@@ -2090,9 +2090,8 @@ static s32 pixinc(int pixels, u8 ps)
 		return 1 + (pixels - 1) * ps;
 	else if (pixels < 0)
 		return 1 - (-pixels + 1) * ps;
-	else
-		BUG();
-		return 0;
+
+	BUG();
 }
 
 static void calc_offset(u16 screen_width, u16 width,
Signature · 6 lines
2.29.2

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 32 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

An old patch added a 'return' statement after each BUG() in this driver, which was necessary at the time, but has become redundant after the BUG() definition was updated to handle this properly.

gcc-11 now warns about one such instance, where the 'return' statement was incorrectly indented:

drivers/gpu/drm/omapdrm/dss/dispc.c: In function ‘pixinc’:
drivers/gpu/drm/omapdrm/dss/dispc.c:2093:9: error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]

  2093 |         else
       |         ^~~~
drivers/gpu/drm/omapdrm/dss/dispc.c:2095:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
  2095 |                 return 0;
       |                 ^~~~~~

Address this by removing the return again and changing the BUG() to be unconditional to make this more intuitive.

Fixes c6eee968d40d ("OMAPDSS: remove compiler warnings when CONFIG_BUG=n")
---
  drivers/gpu/drm/omapdrm/dss/dispc.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/omapdrm/dss/dispc.c +0 -0
index f4cbef8ccace..5619420cc2cc 100644
@@ -2090,9 +2090,8 @@ static s32 pixinc(int pixels, u8 ps)
  		return 1 + (pixels - 1) * ps;

drivers/gpu/drm/omapdrm/dss/dispc.c static s32 pixinc(int pixels, u8 ps) · line 2097

Quoted 10 lines
drivers/gpu/drm/omapdrm/dss/dispc.c +2 -3
  	else if (pixels < 0)
  		return 1 - (-pixels + 1) * ps;
-	else
-		BUG();
-		return 0;
+
+	BUG();
  }
 
  static void calc_offset(u16 screen_width, u16 width,

Thanks, I'll pick this up.

Tomi
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel