ASoC: amd: Return ENODEV if acp63 is not found.
Subsystems (3)
PATCH 1/1 ASoC: amd: Return ENODEV if acp63 is not found.
The clang build fails withsound/soc/amd/ps/pci-ps.c:218:2: error: variable 'ret' is used
uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]
default:
^~~~~~~When no device is found -ENODEV should be returned. A switch with a single case is overkill, change to if-else.
--- sound/soc/amd/ps/pci-ps.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
sound/soc/amd/ps/pci-ps.c +3 -4
@@ -205,8 +205,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_datamemset (&pdevinfo,0 ,sizeof (pdevinfo)); } -switch (adata->pdev_mask) { -case ACP63_PDM_DEV_MASK : +if (adata->pdev_mask ==ACP63_PDM_DEV_MASK ) { adata->pdm_dev_index =0 ;acp63_fill_platform_dev_info (&pdevinfo[0 ], parent,NULL ,"acp_ps_pdm_dma" ,0 , adata->res,1 ,NULL ,0 );
@@ -214,8 +213,8 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data 0, NULL, 0, NULL, 0);acp63_fill_platform_dev_info (&pdevinfo[2 ], parent,NULL ,"acp_ps_mach" ,0 ,NULL ,0 ,NULL ,0 ); -break ; -default : + }else { + ret = -ENODEV ;dev_dbg (&pci->dev,"No PDM devices found\n" ); goto de_init; }
Signature · 1 line
2.27.0
Hi Tom,
Quoted 11 lines · Tom Rix
The clang build fails with
sound/soc/amd/ps/pci-ps.c:218:2: error: variable 'ret' is used
uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]default: ^~~~~~~When no device is found
-ENODEVshould be returned. A switch with a single case is overkill, change to if-else.Fixes 1d325cdaf7a2 ("ASoC: amd: ps: refactor platform device creation logic")Signed-off-by Tom Rix <[email protected]>
Thanks for the patch! I sent basically the same thing earlier today (sorry for forgetting to Cc you directly) and was told it was not correct:
https://lore.kernel.org/[email protected]/
I am just waiting for some feedback before sending a v2.
Quoted 33 lines
--- sound/soc/amd/ps/pci-ps.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)sound/soc/amd/ps/pci-ps.c +3
-4@@ -205,8 +205,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_datamemset (&pdevinfo,0 ,sizeof (pdevinfo)); } -switch (adata->pdev_mask) { -case ACP63_PDM_DEV_MASK : +if (adata->pdev_mask ==ACP63_PDM_DEV_MASK ) { adata->pdm_dev_index =0 ;acp63_fill_platform_dev_info (&pdevinfo[0 ], parent,NULL ,"acp_ps_pdm_dma" ,0 , adata->res,1 ,NULL ,0 );@@ -214,8 +213,8 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data 0, NULL, 0, NULL, 0);acp63_fill_platform_dev_info (&pdevinfo[2 ], parent,NULL ,"acp_ps_mach" ,0 ,NULL ,0 ,NULL ,0 ); -break ; -default : + }else { + ret = -ENODEV ;dev_dbg (&pci->dev,"No PDM devices found\n" ); goto de_init; }Signature · 1 line
2.27.0
Quoted 14 lines · Nathan Chancellor
Hi Tom,
Quoted 11 lines · Tom Rix
The clang build fails with
sound/soc/amd/ps/pci-ps.c:218:2: error: variable 'ret' is used
uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized]default: ^~~~~~~When no device is found
-ENODEVshould be returned. A switch with a single case is overkill, change to if-else.Fixes 1d325cdaf7a2 ("ASoC: amd: ps: refactor platform device creation logic")Signed-off-by Tom Rix <[email protected]>
Quoted 7 lines
Thanks for the patch! I sent basically the same thing earlier today (sorry for forgetting to Cc you directly) and was told it was not correct:
https://lore.kernel.org/[email protected]/
I am just waiting for some feedback before sending a v2.
Looking closer, the pdev_mask is only set to ACP63_PDM_DEV_MASK so the case statement can be folded into the above if-check of pdev_mask.
And the default: dropped, it looks like dead code.
Please cc me on the v2,
Tom
Quoted 34 lines
Quoted 34 lines
--- sound/soc/amd/ps/pci-ps.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)sound/soc/amd/ps/pci-ps.c +3
-4@@ -205,8 +205,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_datamemset (&pdevinfo,0 ,sizeof (pdevinfo)); } -switch (adata->pdev_mask) { -case ACP63_PDM_DEV_MASK : +if (adata->pdev_mask ==ACP63_PDM_DEV_MASK ) { adata->pdm_dev_index =0 ;acp63_fill_platform_dev_info (&pdevinfo[0 ], parent,NULL ,"acp_ps_pdm_dma" ,0 , adata->res,1 ,NULL ,0 );@@ -214,8 +213,8 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data 0, NULL, 0, NULL, 0);acp63_fill_platform_dev_info (&pdevinfo[2 ], parent,NULL ,"acp_ps_mach" ,0 ,NULL ,0 ,NULL ,0 ); -break ; -default : + }else { + ret = -ENODEV ;dev_dbg (&pci->dev,"No PDM devices found\n" ); goto de_init; }Signature · 1 line
2.27.0