linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return
@ 2017-11-17 19:33 Arvind Yadav
  2017-11-17 19:33 ` [PATCH 1/5] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking Arvind Yadav
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

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 and and we must check its return value.

Arvind Yadav (5):
  [PATCH 1/5] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking
  [PATCH 2/5] ASoC: mt8173: Fix platform_get_irq's error checking
  [PATCH 3/5] ASoC: nuc900: Fix platform_get_irq's error checking
  [PATCH 4/5] ASoC: intel: sst: Handle return value of platform_get_irq
  [PATCH 5/5] ASoC: intel: mfld: Handle return value of platform_get_irq

 sound/soc/cirrus/ep93xx-ac97.c             | 4 ++--
 sound/soc/intel/atom/sst/sst_acpi.c        | 3 +++
 sound/soc/intel/boards/mfld_machine.c      | 2 ++
 sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 4 ++--
 sound/soc/nuc900/nuc900-ac97.c             | 4 ++--
 5 files changed, 11 insertions(+), 6 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking
  2017-11-17 19:33 [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return Arvind Yadav
@ 2017-11-17 19:33 ` Arvind Yadav
  2017-11-17 19:33 ` [PATCH 2/5] ASoC: mt8173: " Arvind Yadav
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 sound/soc/cirrus/ep93xx-ac97.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c
index bbf7a92..d66c561 100644
--- a/sound/soc/cirrus/ep93xx-ac97.c
+++ b/sound/soc/cirrus/ep93xx-ac97.c
@@ -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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] ASoC: mt8173: Fix platform_get_irq's error checking
  2017-11-17 19:33 [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return Arvind Yadav
  2017-11-17 19:33 ` [PATCH 1/5] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking Arvind Yadav
@ 2017-11-17 19:33 ` Arvind Yadav
  2017-11-17 19:33 ` [PATCH 3/5] ASoC: nuc900: " Arvind Yadav
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
index 8a643a3..eee27bc 100644
--- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
+++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
@@ -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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] ASoC: nuc900: Fix platform_get_irq's error checking
  2017-11-17 19:33 [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return Arvind Yadav
  2017-11-17 19:33 ` [PATCH 1/5] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking Arvind Yadav
  2017-11-17 19:33 ` [PATCH 2/5] ASoC: mt8173: " Arvind Yadav
@ 2017-11-17 19:33 ` Arvind Yadav
  2017-11-17 19:33 ` [PATCH 4/5] ASoC: intel: sst: Handle return value of platform_get_irq Arvind Yadav
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 sound/soc/nuc900/nuc900-ac97.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c
index b6615af..383627d 100644
--- a/sound/soc/nuc900/nuc900-ac97.c
+++ b/sound/soc/nuc900/nuc900-ac97.c
@@ -346,8 +346,8 @@ static int nuc900_ac97_drvprobe(struct platform_device *pdev)
 	}
 
 	nuc900_audio->irq_num = platform_get_irq(pdev, 0);
-	if (!nuc900_audio->irq_num) {
-		ret = -EBUSY;
+	if (nuc900_audio->irq_num < 0) {
+		ret = nuc900_audio->irq_num;
 		goto out;
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] ASoC: intel: sst: Handle return value of platform_get_irq
  2017-11-17 19:33 [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return Arvind Yadav
                   ` (2 preceding siblings ...)
  2017-11-17 19:33 ` [PATCH 3/5] ASoC: nuc900: " Arvind Yadav
@ 2017-11-17 19:33 ` Arvind Yadav
  2017-11-17 19:33 ` [PATCH 5/5] ASoC: intel: mfld: " Arvind Yadav
  2017-11-18  8:19 ` [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return Russell King - ARM Linux
  5 siblings, 0 replies; 7+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

platform_get_irq() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 sound/soc/intel/atom/sst/sst_acpi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c
index 32d6e02..693b970 100644
--- a/sound/soc/intel/atom/sst/sst_acpi.c
+++ b/sound/soc/intel/atom/sst/sst_acpi.c
@@ -236,6 +236,9 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
 	/* Find the IRQ */
 	ctx->irq_num = platform_get_irq(pdev,
 				ctx->pdata->res_info->acpi_ipc_irq_index);
+	if (ctx->irq_num < 0)
+		return ctx->irq_num;
+
 	return 0;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] ASoC: intel: mfld: Handle return value of platform_get_irq
  2017-11-17 19:33 [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return Arvind Yadav
                   ` (3 preceding siblings ...)
  2017-11-17 19:33 ` [PATCH 4/5] ASoC: intel: sst: Handle return value of platform_get_irq Arvind Yadav
@ 2017-11-17 19:33 ` Arvind Yadav
  2017-11-18  8:19 ` [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return Russell King - ARM Linux
  5 siblings, 0 replies; 7+ messages in thread
From: Arvind Yadav @ 2017-11-17 19:33 UTC (permalink / raw)
  To: linux-arm-kernel

platform_get_irq() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 sound/soc/intel/boards/mfld_machine.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/intel/boards/mfld_machine.c b/sound/soc/intel/boards/mfld_machine.c
index 6f44acf..77b3162 100644
--- a/sound/soc/intel/boards/mfld_machine.c
+++ b/sound/soc/intel/boards/mfld_machine.c
@@ -372,6 +372,8 @@ static int snd_mfld_mc_probe(struct platform_device *pdev)
 
 	/* retrive the irq number */
 	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
 
 	/* audio interrupt base of SRAM location where
 	 * interrupts are stored by System FW */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return
  2017-11-17 19:33 [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return Arvind Yadav
                   ` (4 preceding siblings ...)
  2017-11-17 19:33 ` [PATCH 5/5] ASoC: intel: mfld: " Arvind Yadav
@ 2017-11-18  8:19 ` Russell King - ARM Linux
  5 siblings, 0 replies; 7+ messages in thread
From: Russell King - ARM Linux @ 2017-11-18  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 18, 2017 at 01:03:23AM +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 and and we must check its return value.

IRQ 0 is not a valid interrupt.  The correct test here is <= 0.
Please rework your patches for this.

Thanks.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync@8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-11-18  8:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-17 19:33 [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return Arvind Yadav
2017-11-17 19:33 ` [PATCH 1/5] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking Arvind Yadav
2017-11-17 19:33 ` [PATCH 2/5] ASoC: mt8173: " Arvind Yadav
2017-11-17 19:33 ` [PATCH 3/5] ASoC: nuc900: " Arvind Yadav
2017-11-17 19:33 ` [PATCH 4/5] ASoC: intel: sst: Handle return value of platform_get_irq Arvind Yadav
2017-11-17 19:33 ` [PATCH 5/5] ASoC: intel: mfld: " Arvind Yadav
2017-11-18  8:19 ` [PATCH 0/5] ASoC: Handle platform_get_irq's error checking and return Russell King - ARM Linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).