2017-11-19 04:56:02

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 1/6 v3] mmc: meson-gx-mmc: 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]>
---
changes in v2 :
Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.
changes in v3 :
return -EINVAL instead of irq.

drivers/mmc/host/meson-gx-mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index e0862d3..32a6a22 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1208,7 +1208,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
}

irq = platform_get_irq(pdev, 0);
- if (!irq) {
+ if (irq <= 0) {
dev_err(&pdev->dev, "failed to get interrupt resource.\n");
ret = -EINVAL;
goto free_host;
--
2.7.4


From 1588691290606659836@xxx Thu Jan 04 19:28:00 +0000 2018
X-GM-THRID: 1586056448698861865
X-Gmail-Labels: Inbox,Category Forums,Downloaded_2018-01


2017-11-19 04:55:26

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 3/6 v3] mmc: sdhci-acpi: 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]>
---
changes in v2 :
Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.
changes in v3 :
return -EINVAL instead of host->irq.

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..0d9965b 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 = -EINVAL;
+ goto err_free;
+ }

host->ioaddr = devm_ioremap_nocache(dev, iomem->start,
resource_size(iomem));
--
2.7.4


From 1584734410368838072@xxx Wed Nov 22 03:15:05 +0000 2017
X-GM-THRID: 1583483337964688427
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread

2017-11-19 04:54:28

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 4/6 v3] mmc: sdhci-spear: 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]>
---
changes in v2 :
Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.
changes in v3 :
return -EINVAL instead of host->irq.

drivers/mmc/host/sdhci-spear.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index 8c0f884..e04485e 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -82,6 +82,10 @@ static int sdhci_probe(struct platform_device *pdev)
host->hw_name = "sdhci";
host->ops = &sdhci_pltfm_ops;
host->irq = platform_get_irq(pdev, 0);
+ if (host->irq <= 0) {
+ ret = -EINVAL;
+ goto err_host;
+ }
host->quirks = SDHCI_QUIRK_BROKEN_ADMA;

sdhci = sdhci_priv(host);
--
2.7.4


From 1584575527154843239@xxx Mon Nov 20 09:09:42 +0000 2017
X-GM-THRID: 1584467718411670387
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread

2017-11-19 04:54:30

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 6/6 v3] mmc: sunxi-mmc: 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]>
---
changes in v2 :
Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.
changes in v3 :
return -EINVAL instead of host->irq.

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..c926ac8 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 = -EINVAL;
+ 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 1584464604987286167@xxx Sun Nov 19 03:46:39 +0000 2017
X-GM-THRID: 1583913185349379817
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread

2017-11-19 04:54:25

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 2/6 v3] mmc: s3cmci: 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]>
---
changes in v2 :
Add failure case '<= 0' instead of '< 0'. IRQ0 is not valid.
changes in v3 :
return -EINVAL instead of host->irq.

drivers/mmc/host/s3cmci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
index f7f157a..36daee1 100644
--- a/drivers/mmc/host/s3cmci.c
+++ b/drivers/mmc/host/s3cmci.c
@@ -1658,7 +1658,7 @@ 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;
goto probe_iounmap;
--
2.7.4


From 1585075692050081417@xxx Sat Nov 25 21:39:37 +0000 2017
X-GM-THRID: 1585063639090430392
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread