Skip to content

Commit

Permalink
ASoC: amd: ps: Fix uninitialized ret in create_acp64_platform_devs()
Browse files Browse the repository at this point in the history
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: 1d325cd ("ASoC: amd: ps: refactor platform device creation logic")
Link: ClangBuiltLinux#1779
Suggested-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
  • Loading branch information
nathanchance authored and intel-lab-lkp committed Jan 6, 2023
1 parent 03178b4 commit b1cbe0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/soc/amd/ps/pci-ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit b1cbe0d

Please sign in to comment.