From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
intel-xe@lists.freedesktop.org
Subject: Re: [PATCH] drm/xe: Fix warning on unreachable statement
Date: Fri, 19 Jul 2024 23:59:16 +0200 [thread overview]
Message-ID: <44d38698-8a89-49a9-8fe2-2e6d67c55490@intel.com> (raw)
In-Reply-To: <20240719191534.3845469-1-lucas.demarchi@intel.com>
On 19.07.2024 21:15, Lucas De Marchi wrote:
> 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>
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@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
next prev parent reply other threads:[~2024-07-19 21:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2024-07-21 19:25 ` Nathan Chancellor
2024-07-22 16:39 ` Lucas De Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44d38698-8a89-49a9-8fe2-2e6d67c55490@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox