mmc: sdhci-pltfm: check return value of platform_get_irq()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 20 Apr 2016 02:16:26 +0000 (11:16 +0900)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 2 May 2016 08:33:32 +0000 (10:33 +0200)
The function platform_get_irq() can fail; it returns a negative error
code on failure.  A negative IRQ number will make sdhci_add_host() fail
to request IRQ anyway, but it makes sense to let it fail earlier here.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-pltfm.c

index 03dbdeb..24377a3 100644 (file)
@@ -146,6 +146,11 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
        }
 
        host->irq = platform_get_irq(pdev, 0);
+       if (host->irq < 0) {
+               dev_err(&pdev->dev, "failed to get IRQ number\n");
+               ret = host->irq;
+               goto err_request;
+       }
 
        if (!request_mem_region(iomem->start, resource_size(iomem),
                mmc_hostname(host->mmc))) {