From: Nathan Chancellor <nathan@kernel.org> To: lgirdwood@gmail.com, broonie@kernel.org Cc: Syed.SabaKareem@amd.com, ndesaulniers@google.com, trix@redhat.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Vijendar Mukunda <Vijendar.Mukunda@amd.com>, Nathan Chancellor <nathan@kernel.org> Subject: [PATCH v2] ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs() Date: Thu, 05 Jan 2023 17:43:39 -0700 [thread overview] Message-ID: <20230105-wsometimes-uninitialized-pci-ps-c-v2-1-c50321676325@kernel.org> (raw) Clang warns: sound/soc/amd/ps/pci-ps.c:218:2: error: variable 'ret' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] default: ^~~~~~~ sound/soc/amd/ps/pci-ps.c:239:9: note: uninitialized use occurs here return ret; ^~~ sound/soc/amd/ps/pci-ps.c:190:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 1 error generated. ret is used uninitialized if 'goto de_init' is taken. As this is not an error nor should the ACP be deinitialized, just directly return 0 in this case statement, which resolves the warning. Fixes: 1d325cdaf7a2 ("ASoC: amd: ps: refactor platform device creation logic") Link: https://github.com/ClangBuiltLinux/linux/issues/1779 Suggested-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Signed-off-by: Nathan Chancellor <nathan@kernel.org> --- Changes in v2: - Instead of setting ret to -ENODEV and going to de_init, just 'return 0' in the default case (Vijendar) Link to v1: https://lore.kernel.org/r/20230105-wsometimes-uninitialized-pci-ps-c-v1-1-4022fd077959@kernel.org --- sound/soc/amd/ps/pci-ps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index 401cfd0036be..64648b75de6b 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -217,7 +217,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data break; default: dev_dbg(&pci->dev, "No PDM devices found\n"); - goto de_init; + return 0; } for (index = 0; index < adata->pdev_count; index++) { --- base-commit: 03178b4f7e2c59ead102e5ab5acb82ce1eaefe46 change-id: 20230105-wsometimes-uninitialized-pci-ps-c-3b5725c6ed31 Best regards, -- Nathan Chancellor <nathan@kernel.org>
WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <nathan@kernel.org> To: lgirdwood@gmail.com, broonie@kernel.org Cc: alsa-devel@alsa-project.org, trix@redhat.com, llvm@lists.linux.dev, ndesaulniers@google.com, linux-kernel@vger.kernel.org, Nathan Chancellor <nathan@kernel.org>, Syed.SabaKareem@amd.com, Vijendar Mukunda <Vijendar.Mukunda@amd.com> Subject: [PATCH v2] ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs() Date: Thu, 05 Jan 2023 17:43:39 -0700 [thread overview] Message-ID: <20230105-wsometimes-uninitialized-pci-ps-c-v2-1-c50321676325@kernel.org> (raw) Clang warns: sound/soc/amd/ps/pci-ps.c:218:2: error: variable 'ret' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] default: ^~~~~~~ sound/soc/amd/ps/pci-ps.c:239:9: note: uninitialized use occurs here return ret; ^~~ sound/soc/amd/ps/pci-ps.c:190:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 1 error generated. ret is used uninitialized if 'goto de_init' is taken. As this is not an error nor should the ACP be deinitialized, just directly return 0 in this case statement, which resolves the warning. Fixes: 1d325cdaf7a2 ("ASoC: amd: ps: refactor platform device creation logic") Link: https://github.com/ClangBuiltLinux/linux/issues/1779 Suggested-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Signed-off-by: Nathan Chancellor <nathan@kernel.org> --- Changes in v2: - Instead of setting ret to -ENODEV and going to de_init, just 'return 0' in the default case (Vijendar) Link to v1: https://lore.kernel.org/r/20230105-wsometimes-uninitialized-pci-ps-c-v1-1-4022fd077959@kernel.org --- sound/soc/amd/ps/pci-ps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index 401cfd0036be..64648b75de6b 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -217,7 +217,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data break; default: dev_dbg(&pci->dev, "No PDM devices found\n"); - goto de_init; + return 0; } for (index = 0; index < adata->pdev_count; index++) { --- base-commit: 03178b4f7e2c59ead102e5ab5acb82ce1eaefe46 change-id: 20230105-wsometimes-uninitialized-pci-ps-c-3b5725c6ed31 Best regards, -- Nathan Chancellor <nathan@kernel.org>
next reply other threads:[~2023-01-06 0:43 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-06 0:43 Nathan Chancellor [this message] 2023-01-06 0:43 ` [PATCH v2] ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs() Nathan Chancellor 2023-01-09 11:30 ` syed saba kareem 2023-01-09 11:30 ` syed saba kareem 2023-01-09 12:56 ` Mark Brown 2023-01-09 12:56 ` Mark Brown 2023-01-09 13:21 ` syed saba kareem 2023-01-09 16:49 ` Mark Brown 2023-01-09 16:49 ` Mark Brown
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=20230105-wsometimes-uninitialized-pci-ps-c-v2-1-c50321676325@kernel.org \ --to=nathan@kernel.org \ --cc=Syed.SabaKareem@amd.com \ --cc=Vijendar.Mukunda@amd.com \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=lgirdwood@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=llvm@lists.linux.dev \ --cc=ndesaulniers@google.com \ --cc=trix@redhat.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.