2017-11-19 02:15:49

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 0/3] mfd: Handle platform_get_irq's error checking and return

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


From 1584465649781146117@xxx Sun Nov 19 04:03:15 +0000 2017
X-GM-THRID: 1582152538070897916
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread


2017-11-19 02:24:35

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 1/3] mfd: ipaq-micro: 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 <[email protected]>
---
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


From 1584401087811013143@xxx Sat Nov 18 10:57:04 +0000 2017
X-GM-THRID: 1584401087811013143
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread

2017-11-19 03:13:23

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 3/3] mfd: sun4i-gpadc: Handle return value of platform_get_irq

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

Signed-off-by: Arvind Yadav <[email protected]>
---
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


From 1584822969620042592@xxx Thu Nov 23 02:42:42 +0000 2017
X-GM-THRID: 1584822969620042592
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread