[PATCH 0/6] drm: remove redundant else across drivers
Aditya Garg
gargaditya08 at live.com
Tue Feb 25 11:05:24 UTC 2025
In primary_plane_helper_atomic_check of various drm drivers, a redundant
else statement is there. All these statements match this pattern:
if (foo)
return foo;
else if (bar)
return bar;
Which is equivalent to:
if (foo)
return foo;
if (bar)
return bar;
This error was observed by Andy Shevchenko [1] while reviewing the
appletbdrm driver, which has been submitted upstream.
A simple grep was used to find such errors.
Most likely a common code was copied and pasted among these drivers.
Some of them also seem to have been ported to use atomic helpers instead
of simple_display_pipe.
[1]: https://lore.kernel.org/dri-devel/Z7igVXqvRYTVFpXU@smile.fi.intel.com/
Aditya Garg (6):
drm/ast: Remove redundant else in atomic_check
drm/cirrus-qemu: Remove redundant else in atomic_check
drm/offdrm: Remove redundant else in atomic_check
drm/bochs: Remove redundant else in atomic_check
drm/simpledrm: Remove redundant else in atomic_check
drm/mgag200: Remove redundant else in atomic_check
drivers/gpu/drm/ast/ast_mode.c | 5 +++--
drivers/gpu/drm/mgag200/mgag200_mode.c | 3 ++-
drivers/gpu/drm/tiny/bochs.c | 3 ++-
drivers/gpu/drm/tiny/cirrus-qemu.c | 6 ++++--
drivers/gpu/drm/tiny/ofdrm.c | 3 ++-
drivers/gpu/drm/tiny/simpledrm.c | 3 ++-
6 files changed, 15 insertions(+), 8 deletions(-)
--
2.43.0
More information about the dri-devel
mailing list