aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2014-02-25 04:48:21 -0500
committerChris Ball <chris@printf.net>2014-02-25 15:42:52 -0500
commiteab36b2478aaed00ef381f4e855d4e0c14778a32 (patch)
tree3db0d2587be822e117f323ef1dce50fd94532356 /drivers/mmc/host
parent43aaa50f17c38c16cce2a9a3e73909b7937892a3 (diff)
mmc: sdhci-spear: Fix NULL pointer dereference
pdata could be NULL if cd_gpio = -1. Dereference pdata only if it is not NULL. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/sdhci-spear.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
index 2dba9f8d1760..76ddd89a688e 100644
--- a/drivers/mmc/host/sdhci-spear.c
+++ b/drivers/mmc/host/sdhci-spear.c
@@ -84,14 +84,12 @@ static struct sdhci_plat_data *sdhci_probe_config_dt(struct platform_device *pde
84 /* If pdata is required */ 84 /* If pdata is required */
85 if (cd_gpio != -1) { 85 if (cd_gpio != -1) {
86 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 86 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
87 if (!pdata) { 87 if (!pdata)
88 dev_err(&pdev->dev, "DT: kzalloc failed\n"); 88 dev_err(&pdev->dev, "DT: kzalloc failed\n");
89 return ERR_PTR(-ENOMEM); 89 else
90 } 90 pdata->card_int_gpio = cd_gpio;
91 } 91 }
92 92
93 pdata->card_int_gpio = cd_gpio;
94
95 return pdata; 93 return pdata;
96} 94}
97#else 95#else