All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mfd: Handle platform_get_irq's error checking and return
@ 2017-11-18  6:36 ` Arvind Yadav
  0 siblings, 0 replies; 10+ messages in thread
From: Arvind Yadav @ 2017-11-18  6:36 UTC (permalink / raw)
  To: lee.jones, maxime.ripard, wens; +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 and we must check its return value.

Arvind Yadav (3):
  [PATCH 1/3] mfd: ipaq-micro: Fix platform_get_irq's error checking
  [PATCH 2/3] mfd: intel-lpss: Handle return value of platform_get_*
  [PATCH 3/3] mfd: sun4i-gpadc: Handle return value of platform_get_irq

 drivers/mfd/intel-lpss-acpi.c | 2 ++
 drivers/mfd/ipaq-micro.c      | 4 ++--
 drivers/mfd/sun4i-gpadc.c     | 7 +++++--
 3 files changed, 9 insertions(+), 4 deletions(-)

-- 
2.7.4

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

* [PATCH 0/3] mfd: Handle platform_get_irq's error checking and return
@ 2017-11-18  6:36 ` Arvind Yadav
  0 siblings, 0 replies; 10+ messages in thread
From: Arvind Yadav @ 2017-11-18  6:36 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 we must check its return value.

Arvind Yadav (3):
  [PATCH 1/3] mfd: ipaq-micro: Fix platform_get_irq's error checking
  [PATCH 2/3] mfd: intel-lpss: Handle return value of platform_get_*
  [PATCH 3/3] mfd: sun4i-gpadc: Handle return value of platform_get_irq

 drivers/mfd/intel-lpss-acpi.c | 2 ++
 drivers/mfd/ipaq-micro.c      | 4 ++--
 drivers/mfd/sun4i-gpadc.c     | 7 +++++--
 3 files changed, 9 insertions(+), 4 deletions(-)

-- 
2.7.4

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

* [PATCH 1/3] mfd: ipaq-micro: Fix platform_get_irq's error checking
  2017-11-18  6:36 ` Arvind Yadav
@ 2017-11-18  6:36   ` Arvind Yadav
  -1 siblings, 0 replies; 10+ messages in thread
From: Arvind Yadav @ 2017-11-18  6:36 UTC (permalink / raw)
  To: lee.jones, maxime.ripard, wens; +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>
---
 drivers/mfd/ipaq-micro.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

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

* [PATCH 1/3] mfd: ipaq-micro: Fix platform_get_irq's error checking
@ 2017-11-18  6:36   ` Arvind Yadav
  0 siblings, 0 replies; 10+ messages in thread
From: Arvind Yadav @ 2017-11-18  6:36 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>
---
 drivers/mfd/ipaq-micro.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

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

* [PATCH 2/3] mfd: intel-lpss: Handle return value of platform_get_*
  2017-11-18  6:36 ` Arvind Yadav
@ 2017-11-18  6:36   ` Arvind Yadav
  -1 siblings, 0 replies; 10+ messages in thread
From: Arvind Yadav @ 2017-11-18  6:36 UTC (permalink / raw)
  To: lee.jones, maxime.ripard, wens; +Cc: linux-kernel, linux-arm-kernel

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

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/mfd/intel-lpss-acpi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index 7911b0a..cb84de5 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -92,6 +92,8 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev)
 
 	info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	info->irq = platform_get_irq(pdev, 0);
+	if (!info->mem || info->irq < 0)
+		return -ENOMEM;
 
 	pm_runtime_set_active(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
-- 
2.7.4

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

* [PATCH 2/3] mfd: intel-lpss: Handle return value of platform_get_*
@ 2017-11-18  6:36   ` Arvind Yadav
  0 siblings, 0 replies; 10+ messages in thread
From: Arvind Yadav @ 2017-11-18  6:36 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/mfd/intel-lpss-acpi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index 7911b0a..cb84de5 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -92,6 +92,8 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev)
 
 	info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	info->irq = platform_get_irq(pdev, 0);
+	if (!info->mem || info->irq < 0)
+		return -ENOMEM;
 
 	pm_runtime_set_active(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
-- 
2.7.4

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

* [PATCH 3/3] mfd: sun4i-gpadc: Handle return value of platform_get_irq
  2017-11-18  6:36 ` Arvind Yadav
@ 2017-11-18  6:36   ` Arvind Yadav
  -1 siblings, 0 replies; 10+ messages in thread
From: Arvind Yadav @ 2017-11-18  6:36 UTC (permalink / raw)
  To: lee.jones, maxime.ripard, wens; +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>
---
 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..1c89235 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 irq;
+
 	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] 10+ messages in thread

* [PATCH 3/3] mfd: sun4i-gpadc: Handle return value of platform_get_irq
@ 2017-11-18  6:36   ` Arvind Yadav
  0 siblings, 0 replies; 10+ messages in thread
From: Arvind Yadav @ 2017-11-18  6:36 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>
---
 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..1c89235 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 irq;
+
 	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] 10+ messages in thread

* Re: [PATCH 0/3] mfd: Handle platform_get_irq's error checking and return
  2017-11-18  6:36 ` Arvind Yadav
@ 2017-11-18  8:15   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 10+ messages in thread
From: Russell King - ARM Linux @ 2017-11-18  8:15 UTC (permalink / raw)
  To: Arvind Yadav
  Cc: lee.jones, maxime.ripard, wens, linux-kernel, linux-arm-kernel

On Sat, Nov 18, 2017 at 12:06:30PM +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 we must check its return value.

The failure case is <= 0, not < 0.  IRQ0 is not valid.  Please rework
your patches to that effect, thanks.

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

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

* [PATCH 0/3] mfd: Handle platform_get_irq's error checking and return
@ 2017-11-18  8:15   ` Russell King - ARM Linux
  0 siblings, 0 replies; 10+ messages in thread
From: Russell King - ARM Linux @ 2017-11-18  8:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Nov 18, 2017 at 12:06:30PM +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 we must check its return value.

The failure case is <= 0, not < 0.  IRQ0 is not valid.  Please rework
your patches to that effect, 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] 10+ messages in thread

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

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-18  6:36 [PATCH 0/3] mfd: Handle platform_get_irq's error checking and return Arvind Yadav
2017-11-18  6:36 ` Arvind Yadav
2017-11-18  6:36 ` [PATCH 1/3] mfd: ipaq-micro: Fix platform_get_irq's error checking Arvind Yadav
2017-11-18  6:36   ` Arvind Yadav
2017-11-18  6:36 ` [PATCH 2/3] mfd: intel-lpss: Handle return value of platform_get_* Arvind Yadav
2017-11-18  6:36   ` Arvind Yadav
2017-11-18  6:36 ` [PATCH 3/3] mfd: sun4i-gpadc: Handle return value of platform_get_irq Arvind Yadav
2017-11-18  6:36   ` Arvind Yadav
2017-11-18  8:15 ` [PATCH 0/3] mfd: Handle platform_get_irq's error checking and return Russell King - ARM Linux
2017-11-18  8:15   ` Russell King - ARM Linux

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.