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]>
---
changes in v2 :
Add failure case '<= 0' instead of '< 0'. If IRQ0 is not valid.
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 1584459441686323043@xxx Sun Nov 19 02:24:34 +0000 2017
X-GM-THRID: 1584459441686323043
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread
platform_get_irq() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <[email protected]>
---
changes in v2 :
Add failure case '<= 0' instead of '< 0'. If IRQ0 is not valid.
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 1584462512018945045@xxx Sun Nov 19 03:13:23 +0000 2017
X-GM-THRID: 1584462512018945045
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread
platform_get_irq() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <[email protected]>
---
changes in v2 :
Add failure case '<= 0' instead of '< 0'. If IRQ0 is not valid.
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
From 1584667196105407099@xxx Tue Nov 21 09:26:44 +0000 2017
X-GM-THRID: 1584667196105407099
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread