* [PATCH] selftests/alsa: fix a build warning: return a value in all cases
@ 2024-05-04 2:13 John Hubbard
2024-05-05 14:52 ` Mark Brown
2024-05-05 14:53 ` Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: John Hubbard @ 2024-05-04 2:13 UTC (permalink / raw
To: Shuah Khan
Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, Ivan Orlov,
linux-sound, Valentin Obst, linux-kselftest, LKML, llvm,
John Hubbard
dump_config_tree() is declared to return an int, but the compiler cannot
prove that it always returns any value at all. This leads to a clang
warning, when building via:
make LLVM=1 -C tools/testing/selftests
Fix this by unconditionally returning the "err" variable if the code
reaches the end of the function.
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
tools/testing/selftests/alsa/conf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/alsa/conf.c b/tools/testing/selftests/alsa/conf.c
index 89e3656a042d..0109fde53e6f 100644
--- a/tools/testing/selftests/alsa/conf.c
+++ b/tools/testing/selftests/alsa/conf.c
@@ -116,6 +116,8 @@ static int dump_config_tree(snd_config_t *top)
if (snd_config_save(top, out))
ksft_exit_fail_msg("config save\n");
snd_output_close(out);
+
+ return err;
}
snd_config_t *conf_load_from_file(const char *filename)
base-commit: ddb4c3f25b7b95df3d6932db0b379d768a6ebdf7
prerequisite-patch-id: b901ece2a5b78503e2fb5480f20e304d36a0ea27
--
2.45.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/alsa: fix a build warning: return a value in all cases
2024-05-04 2:13 [PATCH] selftests/alsa: fix a build warning: return a value in all cases John Hubbard
@ 2024-05-05 14:52 ` Mark Brown
2024-05-05 14:53 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2024-05-05 14:52 UTC (permalink / raw
To: John Hubbard
Cc: Shuah Khan, Jaroslav Kysela, Takashi Iwai, Ivan Orlov,
linux-sound, Valentin Obst, linux-kselftest, LKML, llvm
[-- Attachment #1: Type: text/plain, Size: 452 bytes --]
On Fri, May 03, 2024 at 07:13:30PM -0700, John Hubbard wrote:
> dump_config_tree() is declared to return an int, but the compiler cannot
> prove that it always returns any value at all. This leads to a clang
> warning, when building via:
>
> make LLVM=1 -C tools/testing/selftests
>
> Fix this by unconditionally returning the "err" variable if the code
> reaches the end of the function.
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/alsa: fix a build warning: return a value in all cases
2024-05-04 2:13 [PATCH] selftests/alsa: fix a build warning: return a value in all cases John Hubbard
2024-05-05 14:52 ` Mark Brown
@ 2024-05-05 14:53 ` Mark Brown
2024-05-05 20:57 ` John Hubbard
1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2024-05-05 14:53 UTC (permalink / raw
To: John Hubbard
Cc: Shuah Khan, Jaroslav Kysela, Takashi Iwai, Ivan Orlov,
linux-sound, Valentin Obst, linux-kselftest, LKML, llvm
[-- Attachment #1: Type: text/plain, Size: 317 bytes --]
On Fri, May 03, 2024 at 07:13:30PM -0700, John Hubbard wrote:
> dump_config_tree() is declared to return an int, but the compiler cannot
> prove that it always returns any value at all. This leads to a clang
> warning, when building via:
Though given that the function isn't referenced we could also just
delete it.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/alsa: fix a build warning: return a value in all cases
2024-05-05 14:53 ` Mark Brown
@ 2024-05-05 20:57 ` John Hubbard
0 siblings, 0 replies; 4+ messages in thread
From: John Hubbard @ 2024-05-05 20:57 UTC (permalink / raw
To: Mark Brown
Cc: Shuah Khan, Jaroslav Kysela, Takashi Iwai, Ivan Orlov,
linux-sound, Valentin Obst, linux-kselftest, LKML, llvm
On 5/5/24 7:53 AM, Mark Brown wrote:
> On Fri, May 03, 2024 at 07:13:30PM -0700, John Hubbard wrote:
>> dump_config_tree() is declared to return an int, but the compiler cannot
>> prove that it always returns any value at all. This leads to a clang
>> warning, when building via:
>
> Though given that the function isn't referenced we could also just
> delete it.
Even better, thanks for spotting that. I'll send a v2 to delete it.
thanks,
--
John Hubbard
NVIDIA
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-05 20:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-04 2:13 [PATCH] selftests/alsa: fix a build warning: return a value in all cases John Hubbard
2024-05-05 14:52 ` Mark Brown
2024-05-05 14:53 ` Mark Brown
2024-05-05 20:57 ` John Hubbard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).