[alsa-devel] [PATCH 1/5 v2] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking
The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct.
Signed-off-by: Arvind Yadav arvind.yadav.cs@gmail.com --- changes in v2 : irq was unsigned. so changed it to signed.
sound/soc/cirrus/ep93xx-ac97.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c index bbf7a92..b86b83b 100644 --- a/sound/soc/cirrus/ep93xx-ac97.c +++ b/sound/soc/cirrus/ep93xx-ac97.c @@ -365,7 +365,7 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) { struct ep93xx_ac97_info *info; struct resource *res; - unsigned int irq; + int irq; int ret;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); @@ -378,8 +378,8 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) return PTR_ERR(info->regs);
irq = platform_get_irq(pdev, 0); - if (!irq) - return -ENODEV; + if (irq < 0) + return irq;
ret = devm_request_irq(&pdev->dev, irq, ep93xx_ac97_interrupt, IRQF_TRIGGER_HIGH, pdev->name, info);
The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct.
Signed-off-by: Arvind Yadav arvind.yadav.cs@gmail.com --- chnages in v2 : irq_id was unsigned. so changed it to signed.
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c index 8a643a3..11f5f2a 100644 --- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c +++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c @@ -1083,7 +1083,7 @@ static int mt8173_afe_init_audio_clk(struct mtk_base_afe *afe) static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev) { int ret, i; - unsigned int irq_id; + int irq_id; struct mtk_base_afe *afe; struct mt8173_afe_private *afe_priv; struct resource *res; @@ -1105,9 +1105,9 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev) afe->dev = &pdev->dev;
irq_id = platform_get_irq(pdev, 0); - if (!irq_id) { + if (irq_id < 0) { dev_err(afe->dev, "np %s no irq\n", afe->dev->of_node->name); - return -ENXIO; + return irq_id; } ret = devm_request_irq(afe->dev, irq_id, mt8173_afe_irq_handler, 0, "Afe_ISR_Handle", (void *)afe);
On Sat, Nov 18, 2017 at 10:57:52AM +0530, Arvind Yadav wrote:
The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct.
IRQ 0 is not a valid interrupt. The correct test here is <= 0. Please rework your patches for this.
Thanks.
The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct.
Signed-off-by: Arvind Yadav arvind.yadav.cs@gmail.com --- changes in v2 : nuc900_audio->irq_num is unsigned. so handle through signed variable.
sound/soc/nuc900/nuc900-ac97.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index b6615af..71fce7c 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c @@ -345,11 +345,10 @@ static int nuc900_ac97_drvprobe(struct platform_device *pdev) goto out; }
- nuc900_audio->irq_num = platform_get_irq(pdev, 0); - if (!nuc900_audio->irq_num) { - ret = -EBUSY; + ret = platform_get_irq(pdev, 0); + if (ret < 0) goto out; - } + nuc900_audio->irq_num = ret;
nuc900_ac97_data = nuc900_audio;
On Sat, Nov 18, 2017 at 10:57:53AM +0530, Arvind Yadav wrote:
The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct.
IRQ 0 is not a valid interrupt. The correct test here is <= 0. Please rework your patches for this.
Thanks.
On Sat, Nov 18, 2017 at 10:57:51AM +0530, Arvind Yadav wrote:
The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct.
IRQ 0 is not a valid interrupt. The correct test here is <= 0. Please rework your patches for this.
Thanks.
participants (2)
-
Arvind Yadav
-
Russell King - ARM Linux