linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3 v3] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking
@ 2017-11-18  9:56 Arvind Yadav
  2017-11-18  9:56 ` [PATCH 2/3 v3] ASoC: mt8173: " Arvind Yadav
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Arvind Yadav @ 2017-11-18  9:56 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>
---
changes in v2 :
               irq was unsigned. so changed it to signed.
changes in v3 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 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);
-- 
2.7.4

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

* [PATCH 2/3 v3] ASoC: mt8173: Fix platform_get_irq's error checking
  2017-11-18  9:56 [PATCH 1/3 v3] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking Arvind Yadav
@ 2017-11-18  9:56 ` Arvind Yadav
  2017-11-18  9:56 ` [PATCH 3/3 v3] ASoC: nuc900: " Arvind Yadav
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Arvind Yadav @ 2017-11-18  9:56 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>
---
changes in v2 :
               irq was unsigned. so changed it to signed.
changes in v3 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 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);
-- 
2.7.4

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

* [PATCH 3/3 v3] ASoC: nuc900: Fix platform_get_irq's error checking
  2017-11-18  9:56 [PATCH 1/3 v3] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking Arvind Yadav
  2017-11-18  9:56 ` [PATCH 2/3 v3] ASoC: mt8173: " Arvind Yadav
@ 2017-11-18  9:56 ` Arvind Yadav
  2017-11-18  9:56 ` [PATCH 4/5 v2] ASoC: intel: sst: Handle return value of platform_get_irq Arvind Yadav
  2017-11-18  9:56 ` [PATCH 5/5 v2] ASoC: intel: mfld: " Arvind Yadav
  3 siblings, 0 replies; 5+ messages in thread
From: Arvind Yadav @ 2017-11-18  9:56 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>
---
changes in v2 :
               irq was unsigned. so using signed variable ret.
changes in v3 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 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;
 
-- 
2.7.4

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

* [PATCH 4/5 v2] ASoC: intel: sst: Handle return value of platform_get_irq
  2017-11-18  9:56 [PATCH 1/3 v3] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking Arvind Yadav
  2017-11-18  9:56 ` [PATCH 2/3 v3] ASoC: mt8173: " Arvind Yadav
  2017-11-18  9:56 ` [PATCH 3/3 v3] ASoC: nuc900: " Arvind Yadav
@ 2017-11-18  9:56 ` Arvind Yadav
  2017-11-18  9:56 ` [PATCH 5/5 v2] ASoC: intel: mfld: " Arvind Yadav
  3 siblings, 0 replies; 5+ messages in thread
From: Arvind Yadav @ 2017-11-18  9:56 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>
---
changes in v2 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 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] 5+ messages in thread

* [PATCH 5/5 v2] ASoC: intel: mfld: Handle return value of platform_get_irq
  2017-11-18  9:56 [PATCH 1/3 v3] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking Arvind Yadav
                   ` (2 preceding siblings ...)
  2017-11-18  9:56 ` [PATCH 4/5 v2] ASoC: intel: sst: Handle return value of platform_get_irq Arvind Yadav
@ 2017-11-18  9:56 ` Arvind Yadav
  3 siblings, 0 replies; 5+ messages in thread
From: Arvind Yadav @ 2017-11-18  9:56 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>
---
changes in v2 :
              Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.

 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] 5+ messages in thread

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-18  9:56 [PATCH 1/3 v3] ASoC: ep93xx-ac97: Fix platform_get_irq's error checking Arvind Yadav
2017-11-18  9:56 ` [PATCH 2/3 v3] ASoC: mt8173: " Arvind Yadav
2017-11-18  9:56 ` [PATCH 3/3 v3] ASoC: nuc900: " Arvind Yadav
2017-11-18  9:56 ` [PATCH 4/5 v2] ASoC: intel: sst: Handle return value of platform_get_irq Arvind Yadav
2017-11-18  9:56 ` [PATCH 5/5 v2] ASoC: intel: mfld: " Arvind Yadav

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).