On 05/01/23 23:04, Nathan Chancellor wrote:
On Thu, Jan 05, 2023 at 10:11:09AM -0700, Nathan Chancellor wrote:
On Thu, Jan 05, 2023 at 10:34:10PM +0530, Mukunda,Vijendar wrote:
On 05/01/23 21:23, Nathan Chancellor wrote:
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.
Return -ENODEV, which matches the debug message's description of this block.
Fixes: 1d325cdaf7a2 ("ASoC: amd: ps: refactor platform device creation logic") Link: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com... Signed-off-by: Nathan Chancellor nathan@kernel.org
sound/soc/amd/ps/pci-ps.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c index 401cfd0036be..f54b9fd9c3ce 100644 --- a/sound/soc/amd/ps/pci-ps.c +++ b/sound/soc/amd/ps/pci-ps.c @@ -217,6 +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");
ret = -ENODEV;
ACP PCI driver supports different configurations. As per design , evenĀ when no child dev nodes are created , ACP driver probe should be successful. ACP PCI driver probe failure causes power state transition failures when no child device nodes are created. We should not return -ENODEV in this case. return 0 is enough in this case. No need to de-init the ACP.
Thank you for the review and input and sorry for getting it wrong! I will send a v2 replacing 'break;' with 'return 0;' shortly.
Actually, I re-read your message and looked at the code now that I am back in front of my keyboard and I am a little confused by your message. Should 'goto de_init' be replaced with 'return 0' to avoid the call to acp63_deinit() or should ret just be initialized to 0 in this block so that the call to acp63_deinit() still happens?
Thanks again for your input! Nathan
'goto de-init' should be replaced with 'return 0' for default case.
- Vijendar
goto de_init;
}
base-commit: 03178b4f7e2c59ead102e5ab5acb82ce1eaefe46 change-id: 20230105-wsometimes-uninitialized-pci-ps-c-3b5725c6ed31
Best regards,