ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs()
authorNathan Chancellor <nathan@kernel.org>
Fri, 6 Jan 2023 00:43:39 +0000 (17:43 -0700)
committerMark Brown <broonie@kernel.org>
Mon, 9 Jan 2023 13:05:31 +0000 (13:05 +0000)
commitde1cae22898cf10aacc735a21d799b5bbce4496c
tree904af7ddbaa20d55a8af4dc925340106d0634b78
parentffb2bbdf79d7e712782fd5f44fc250f3e07b3b92
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: 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>
Reviewed-by: Syed Saba Kareem <syed.sabakareem@amd.com>
Link: https://lore.kernel.org/r/20230105-wsometimes-uninitialized-pci-ps-c-v2-1-c50321676325@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/amd/ps/pci-ps.c