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 and we must check its return value.
Arvind Yadav (6):
[PATCH 1/6] mmc: meson-gx-mmc: Fix platform_get_irq's error checking
[PATCH 2/6] mmc: s3cmci: Fix platform_get_irq's error checking
[PATCH 3/6] mmc: sdhci-acpi: Handle return value of platform_get_irq
[PATCH 4/6] mmc: sdhci-spear: Handle return value of platform_get_irq
[PATCH 5/6] mmc: sh_mmcif: Handle return value of platform_get_irq
[PATCH 6/6] mmc: sunxi-mmc: Handle return value of platform_get_irq
drivers/mmc/host/meson-gx-mmc.c | 4 ++--
drivers/mmc/host/s3cmci.c | 4 ++--
drivers/mmc/host/sdhci-acpi.c | 4 ++++
drivers/mmc/host/sdhci-spear.c | 4 ++++
drivers/mmc/host/sh_mmcif.c | 2 +-
drivers/mmc/host/sunxi-mmc.c | 5 +++++
6 files changed, 18 insertions(+), 5 deletions(-)
--
2.7.4
From 1584463603826126487@xxx Sun Nov 19 03:30:44 +0000 2017
X-GM-THRID: 1580974306711346344
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]>
---
drivers/mmc/host/sunxi-mmc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index cc98355d..ec2a16b 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -1255,6 +1255,11 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
goto error_assert_reset;
host->irq = platform_get_irq(pdev, 0);
+ if (host->irq < 0) {
+ ret = host->irq;
+ goto error_assert_reset;
+ }
+
return devm_request_threaded_irq(&pdev->dev, host->irq, sunxi_mmc_irq,
sunxi_mmc_handle_manual_stop, 0, "sunxi-mmc", host);
--
2.7.4
From 1584421201319541605@xxx Sat Nov 18 16:16:46 +0000 2017
X-GM-THRID: 1583981608160833190
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]>
---
drivers/mmc/host/sh_mmcif.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 53fb18b..481f2c4 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1405,7 +1405,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
irq[0] = platform_get_irq(pdev, 0);
irq[1] = platform_get_irq(pdev, 1);
- if (irq[0] < 0) {
+ if (irq[0] < 0 || irq[1] < 0) {
dev_err(dev, "Get irq error\n");
return -ENXIO;
}
--
2.7.4
From 1584465738257676346@xxx Sun Nov 19 04:04:39 +0000 2017
X-GM-THRID: 1584465680942993442
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread
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/mmc/host/s3cmci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
index f7f157a..cc801bc 100644
--- a/drivers/mmc/host/s3cmci.c
+++ b/drivers/mmc/host/s3cmci.c
@@ -1658,9 +1658,9 @@ static int s3cmci_probe(struct platform_device *pdev)
}
host->irq = platform_get_irq(pdev, 0);
- if (host->irq == 0) {
+ if (host->irq < 0) {
dev_err(&pdev->dev, "failed to get interrupt resource.\n");
- ret = -EINVAL;
+ ret = host->irq;
goto probe_iounmap;
}
--
2.7.4
From 1584356415792572683@xxx Fri Nov 17 23:07:01 +0000 2017
X-GM-THRID: 1584307913641670088
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]>
---
drivers/mmc/host/sdhci-acpi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index b988997..dd8129e 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -566,6 +566,10 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
host->hw_name = "ACPI";
host->ops = &sdhci_acpi_ops_dflt;
host->irq = platform_get_irq(pdev, 0);
+ if (host->irq < 0) {
+ err = host->irq;
+ goto err_free;
+ }
host->ioaddr = devm_ioremap_nocache(dev, iomem->start,
resource_size(iomem));
--
2.7.4
From 1584100037187142716@xxx Wed Nov 15 03:12:00 +0000 2017
X-GM-THRID: 1584100037187142716
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread