Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe: Fix warning on unreachable statement
@ 2024-07-19 19:15 Lucas De Marchi
  2024-07-19 19:20 ` ✓ CI.Patch_applied: success for " Patchwork
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Lucas De Marchi @ 2024-07-19 19:15 UTC (permalink / raw)
  To: intel-xe; +Cc: Lucas De Marchi, Michal Wajdeczko

eu_type_to_str() relies on -Wswitch to warn (and -Werror) to make sure
it handles all enum values. However it's perfectly legal to pass an int
to that function so in the end that function may happen to return
nothing. A smart compiler could notice eu_type is never assigned to
anything other than those values.

Trying to reproduce this issue, none of gcc-9, gcc-10 and gcc-13
triggered for me, but this was reported in a different system with
gcc-10:

	drivers/gpu/drm/xe/xe.o: warning: objtool: xe_gt_topology_dump() falls through to next function xe_gt_topology_init()

Since that is not really possible, just take the simple approach and
return NULL.

Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_gt_topology.c b/drivers/gpu/drm/xe/xe_gt_topology.c
index 5a1559edf3e9..0662f71c6ede 100644
--- a/drivers/gpu/drm/xe/xe_gt_topology.c
+++ b/drivers/gpu/drm/xe/xe_gt_topology.c
@@ -233,7 +233,7 @@ static const char *eu_type_to_str(enum xe_gt_eu_type eu_type)
 		return "simd8";
 	}
 
-	unreachable();
+	return NULL;
 }
 
 void
-- 
2.43.0


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

end of thread, other threads:[~2024-07-22 16:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-19 19:15 [PATCH] drm/xe: Fix warning on unreachable statement Lucas De Marchi
2024-07-19 19:20 ` ✓ CI.Patch_applied: success for " Patchwork
2024-07-19 19:20 ` ✓ CI.checkpatch: " Patchwork
2024-07-19 19:21 ` ✗ CI.KUnit: failure " Patchwork
2024-07-19 19:59 ` [PATCH] " Matthew Brost
2024-07-19 20:38   ` Lucas De Marchi
2024-07-19 21:59 ` Michal Wajdeczko
2024-07-21 19:25 ` Nathan Chancellor
2024-07-22 16:39   ` Lucas De Marchi

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