Linux virtualization list
 help / color / mirror / Atom feed
* [PATCH 0/6] drm: remove redundant else across drivers
@ 2025-02-25 11:05 Aditya Garg
  2025-02-25 11:06 ` [PATCH 1/6] drm/ast: Remove redundant else in atomic_check Aditya Garg
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Aditya Garg @ 2025-02-25 11:05 UTC (permalink / raw)
  To: airlied@redhat.com, tzimmermann@suse.de, jfalempe@redhat.com,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	airlied@gmail.com, simona@ffwll.ch, kraxel@redhat.com,
	javierm@redhat.com
  Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux.dev, andriy.shevchenko@linux.intel.com

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-02-25 11:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-25 11:05 [PATCH 0/6] drm: remove redundant else across drivers Aditya Garg
2025-02-25 11:06 ` [PATCH 1/6] drm/ast: Remove redundant else in atomic_check Aditya Garg
2025-02-25 11:49   ` Thomas Zimmermann
2025-02-25 11:50     ` Aditya Garg
2025-02-25 11:06 ` [PATCH 2/6] drm/cirrus-qemu: " Aditya Garg
2025-02-25 11:07 ` [PATCH 3/6] drm/offdrm: " Aditya Garg
2025-02-25 11:07 ` [PATCH 4/6] drm/bochs: " Aditya Garg
2025-02-25 11:08 ` [PATCH 5/6] drm/simpledrm: " Aditya Garg
2025-02-25 11:08 ` [PATCH 6/6] drm/mgag200: " Aditya Garg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox