Skip to contentSkip to conversation

ASoC: amd: Fix an ignored error return from platform_get_irq_byname()

PATCH Superseded Yang Li 2 participants 4 messages Mar 1, 2022 – Mar 2, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 ASoC: amd: Fix an ignored error return from platform_get_irq_byname()

The return from the call to platform_get_irq_byname() is int, it can be a negative error code, however this is being assigned to an unsigned int variable 'adata->i2s_irq', so assign the value to 'ret' concurrently to solve this problem without affecting other functions.

Eliminate the following coccicheck warning:
./sound/soc/amd/acp/acp-renoir.c:286:5-19: WARNING: Unsigned expression compared with zero: adata -> i2s_irq < 0

Fixes 3304a242f45a ("ASoC: amd: Use platform_get_irq_byname() to get the interrupt")
---
 sound/soc/amd/acp/acp-renoir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/amd/acp/acp-renoir.c +2 -2
index 738cf2e2b973..64e824161091 100644
@@ -282,8 +282,8 @@ static int renoir_audio_probe(struct platform_device *pdev)
 	if (!adata->acp_base)
 		return -ENOMEM;
 
-	adata->i2s_irq = platform_get_irq_byname(pdev, "acp_dai_irq");
-	if (adata->i2s_irq < 0)
+	adata->i2s_irq = ret = platform_get_irq_byname(pdev, "acp_dai_irq");
+	if (ret < 0)
 		return -ENODEV;
 
 	adata->dev = dev;
Signature · 1 line
2.20.1.7.g153144c
maintainer
#1 lore raw

sound/soc/amd/acp/acp-renoir.c static int renoir_audio_probe(struct platform_device *pdev) · line 287

Quoted 5 lines · Yang Li
sound/soc/amd/acp/acp-renoir.c +2 -2
-	adata->i2s_irq = platform_get_irq_byname(pdev, "acp_dai_irq");
-	if (adata->i2s_irq < 0)
+	adata->i2s_irq = ret = platform_get_irq_byname(pdev, "acp_dai_irq");
+	if (ret < 0)
 		return -ENODEV;

If an error code is being returned we should report that error code rather than squashing it down to -ENODEV.

author
#2 lore raw

The function dev_err_probe() is called in function platform_get_irq_byname() to print the error code.
------------------------------------------------------------------
发件人:Mark Brown <[email protected]>
发送时间:2022年3月1日(星期二) 20:40
收件人:Yang Li <[email protected]>
抄 送:lgirdwood <[email protected]>; perex <[email protected]>; tiwai <[email protected]>; tangmeng <[email protected]>; alsa-devel <[email protected]>; linux-kernel <[email protected]>; Abaci Robot <[email protected]> 主 题:Re: [PATCH -next] ASoC: amd: Fix an ignored error return from platform_get_irq_byname()

Quoted 5 lines · Yang Li

- adata->i2s_irq = platform_get_irq_byname(pdev, "acp_dai_irq");
- if (adata->i2s_irq < 0)
+ adata->i2s_irq = ret = platform_get_irq_byname(pdev, "acp_dai_irq");
+ if (ret < 0)
return -ENODEV;

If an error code is being returned we should report that error code rather than squashing it down to -ENODEV.

maintainer
#3 lore raw

On Wed, Mar 02, 2022 at 09:17:21AM +0800, Yang.Lee wrote:

Please don't top post, reply in line with needed context. This allows readers to readily follow the flow of conversation and understand what you are talking about and also helps ensure that everything in the discussion is being addressed.

Quoted 1 line

The function dev_err_probe() is called in function platform_get_irq_byname() to print the error code.

That doesn't seem at all relevant to the error code being returned which is what the review feedback was about:

Quoted 2 lines
Quoted 2 lines

If an error code is being returned we should report that error code rather than squashing it down to -ENODEV.

Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to.