All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3 v3] mfd: ipaq-micro: Fix platform_get_irq's error checking
@ 2017-11-19  4:26 ` Arvind Yadav
  0 siblings, 0 replies; 6+ messages in thread
From: Arvind Yadav @ 2017-11-19  4:26 UTC (permalink / raw)
  To: lee.jones, maxime.ripard, wens, linux; +Cc: linux-kernel, 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 :
              Add failure case '<= 0' instead of '< 0'. If IRQ0 is not valid.
changes in v3 :
              return -EINVAL insted of irq.

 drivers/mfd/ipaq-micro.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/ipaq-micro.c b/drivers/mfd/ipaq-micro.c
index cd762d0..176cf65 100644
--- a/drivers/mfd/ipaq-micro.c
+++ b/drivers/mfd/ipaq-micro.c
@@ -410,7 +410,7 @@ static int __init micro_probe(struct platform_device *pdev)
 	micro_reset_comm(micro);
 
 	irq = platform_get_irq(pdev, 0);
-	if (!irq)
+	if (irq <= 0)
 		return -EINVAL;
 	ret = devm_request_irq(&pdev->dev, irq, micro_serial_isr,
 			       IRQF_SHARED, "ipaq-micro",
-- 
2.7.4

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

* [PATCH 1/3 v3] mfd: ipaq-micro: Fix platform_get_irq's error checking
@ 2017-11-19  4:26 ` Arvind Yadav
  0 siblings, 0 replies; 6+ messages in thread
From: Arvind Yadav @ 2017-11-19  4:26 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 :
              Add failure case '<= 0' instead of '< 0'. If IRQ0 is not valid.
changes in v3 :
              return -EINVAL insted of irq.

 drivers/mfd/ipaq-micro.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/ipaq-micro.c b/drivers/mfd/ipaq-micro.c
index cd762d0..176cf65 100644
--- a/drivers/mfd/ipaq-micro.c
+++ b/drivers/mfd/ipaq-micro.c
@@ -410,7 +410,7 @@ static int __init micro_probe(struct platform_device *pdev)
 	micro_reset_comm(micro);
 
 	irq = platform_get_irq(pdev, 0);
-	if (!irq)
+	if (irq <= 0)
 		return -EINVAL;
 	ret = devm_request_irq(&pdev->dev, irq, micro_serial_isr,
 			       IRQF_SHARED, "ipaq-micro",
-- 
2.7.4

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

* [PATCH 3/3 v3] mfd: sun4i-gpadc: Handle return value of platform_get_irq
  2017-11-19  4:26 ` Arvind Yadav
@ 2017-11-19  4:26   ` Arvind Yadav
  -1 siblings, 0 replies; 6+ messages in thread
From: Arvind Yadav @ 2017-11-19  4:26 UTC (permalink / raw)
  To: lee.jones, maxime.ripard, wens, linux; +Cc: linux-kernel, 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'. If IRQ0 is not valid.
changes in v3 :
              return -EINVAL insted of irq.

 drivers/mfd/sun4i-gpadc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/sun4i-gpadc.c b/drivers/mfd/sun4i-gpadc.c
index 9cfc881..79a39fe 100644
--- a/drivers/mfd/sun4i-gpadc.c
+++ b/drivers/mfd/sun4i-gpadc.c
@@ -100,8 +100,8 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
 	struct resource *mem;
 	const struct of_device_id *of_id;
 	const struct mfd_cell *cells;
-	unsigned int irq, size;
-	int ret;
+	unsigned int size;
+	int ret, irq;
 
 	of_id = of_match_node(sun4i_gpadc_of_match, pdev->dev.of_node);
 	if (!of_id)
@@ -148,6 +148,9 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
 	regmap_write(dev->regmap, SUN4I_GPADC_INT_FIFOC, 0);
 
 	irq = platform_get_irq(pdev, 0);
+	if (irq <= 0)
+		return -EINVAL;
+
 	ret = devm_regmap_add_irq_chip(&pdev->dev, dev->regmap, irq,
 				       IRQF_ONESHOT, 0,
 				       &sun4i_gpadc_regmap_irq_chip,
-- 
2.7.4

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

* [PATCH 3/3 v3] mfd: sun4i-gpadc: Handle return value of platform_get_irq
@ 2017-11-19  4:26   ` Arvind Yadav
  0 siblings, 0 replies; 6+ messages in thread
From: Arvind Yadav @ 2017-11-19  4:26 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'. If IRQ0 is not valid.
changes in v3 :
              return -EINVAL insted of irq.

 drivers/mfd/sun4i-gpadc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/sun4i-gpadc.c b/drivers/mfd/sun4i-gpadc.c
index 9cfc881..79a39fe 100644
--- a/drivers/mfd/sun4i-gpadc.c
+++ b/drivers/mfd/sun4i-gpadc.c
@@ -100,8 +100,8 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
 	struct resource *mem;
 	const struct of_device_id *of_id;
 	const struct mfd_cell *cells;
-	unsigned int irq, size;
-	int ret;
+	unsigned int size;
+	int ret, irq;
 
 	of_id = of_match_node(sun4i_gpadc_of_match, pdev->dev.of_node);
 	if (!of_id)
@@ -148,6 +148,9 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
 	regmap_write(dev->regmap, SUN4I_GPADC_INT_FIFOC, 0);
 
 	irq = platform_get_irq(pdev, 0);
+	if (irq <= 0)
+		return -EINVAL;
+
 	ret = devm_regmap_add_irq_chip(&pdev->dev, dev->regmap, irq,
 				       IRQF_ONESHOT, 0,
 				       &sun4i_gpadc_regmap_irq_chip,
-- 
2.7.4

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

* Re: [PATCH 1/3 v3] mfd: ipaq-micro: Fix platform_get_irq's error checking
  2017-11-19  4:26 ` Arvind Yadav
@ 2020-08-27  7:36   ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27  7:36 UTC (permalink / raw)
  To: Arvind Yadav
  Cc: lee.jones, maxime.ripard, wens, linux, linux-kernel, linux-arm-kernel

On Sun, 19 Nov 2017 at 05:28, Arvind Yadav <arvind.yadav.cs@gmail.com> 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.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> changes in v2 :
>               Add failure case '<= 0' instead of '< 0'. If IRQ0 is not valid.
> changes in v3 :
>               return -EINVAL insted of irq.
>
>  drivers/mfd/ipaq-micro.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Hi Arvind,

This was never applied. Can you rebase and resend the entire series?
Or maybe there was a reason to drop it?

Best Regards,
Krzysztof

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

* Re: [PATCH 1/3 v3] mfd: ipaq-micro: Fix platform_get_irq's error checking
@ 2020-08-27  7:36   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27  7:36 UTC (permalink / raw)
  To: Arvind Yadav
  Cc: linux-kernel, linux, wens, maxime.ripard, lee.jones, linux-arm-kernel

On Sun, 19 Nov 2017 at 05:28, Arvind Yadav <arvind.yadav.cs@gmail.com> 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.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> changes in v2 :
>               Add failure case '<= 0' instead of '< 0'. If IRQ0 is not valid.
> changes in v3 :
>               return -EINVAL insted of irq.
>
>  drivers/mfd/ipaq-micro.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Hi Arvind,

This was never applied. Can you rebase and resend the entire series?
Or maybe there was a reason to drop it?

Best Regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-08-27  7:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-19  4:26 [PATCH 1/3 v3] mfd: ipaq-micro: Fix platform_get_irq's error checking Arvind Yadav
2017-11-19  4:26 ` Arvind Yadav
2017-11-19  4:26 ` [PATCH 3/3 v3] mfd: sun4i-gpadc: Handle return value of platform_get_irq Arvind Yadav
2017-11-19  4:26   ` Arvind Yadav
2020-08-27  7:36 ` [PATCH 1/3 v3] mfd: ipaq-micro: Fix platform_get_irq's error checking Krzysztof Kozlowski
2020-08-27  7:36   ` Krzysztof Kozlowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.