Commit de1cae22 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Mark Brown

ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs()

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: 1d325cda ("ASoC: amd: ps: refactor platform device creation logic")
Link: https://github.com/ClangBuiltLinux/linux/issues/1779Suggested-by: default avatarVijendar Mukunda <Vijendar.Mukunda@amd.com>
Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
Reviewed-by: default avatarSyed Saba Kareem <syed.sabakareem@amd.com>
Link: https://lore.kernel.org/r/20230105-wsometimes-uninitialized-pci-ps-c-v2-1-c50321676325@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ffb2bbdf
......@@ -222,7 +222,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++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment