[PATCH 3/6 v3] mmc: sdhci-acpi: Handle return value of platform_get_irq

From: Arvind Yadav
Date: Sat Nov 18 2017 - 23:53:26 EST


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

Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
---
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