提交 eab36b24 编写于 作者: S Sachin Kamat 提交者: Chris Ball

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: NSachin Kamat <sachin.kamat@linaro.org>
Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: NChris Ball <chris@printf.net>
上级 43aaa50f
...@@ -84,14 +84,12 @@ static struct sdhci_plat_data *sdhci_probe_config_dt(struct platform_device *pde ...@@ -84,14 +84,12 @@ static struct sdhci_plat_data *sdhci_probe_config_dt(struct platform_device *pde
/* If pdata is required */ /* If pdata is required */
if (cd_gpio != -1) { if (cd_gpio != -1) {
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) { if (!pdata)
dev_err(&pdev->dev, "DT: kzalloc failed\n"); dev_err(&pdev->dev, "DT: kzalloc failed\n");
return ERR_PTR(-ENOMEM); else
} pdata->card_int_gpio = cd_gpio;
} }
pdata->card_int_gpio = cd_gpio;
return pdata; return pdata;
} }
#else #else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册