Commit 43aaa50f authored by Sachin Kamat's avatar Sachin Kamat Committed by Chris Ball

mmc: wmt-sdmmc: Fix NULL pointer dereference

'of_id' is dereferenced before NULL pointer check. Move it to
after the check.
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Acked-by: default avatarTony Prisk <linux@prisktech.co.nz>
Signed-off-by: default avatarChris Ball <chris@printf.net>
parent c4c7fb19
......@@ -757,7 +757,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
const struct of_device_id *of_id =
of_match_device(wmt_mci_dt_ids, &pdev->dev);
const struct wmt_mci_caps *wmt_caps = of_id->data;
const struct wmt_mci_caps *wmt_caps;
int ret;
int regular_irq, dma_irq;
......@@ -766,6 +766,8 @@ static int wmt_mci_probe(struct platform_device *pdev)
return -EFAULT;
}
wmt_caps = of_id->data;
if (!np) {
dev_err(&pdev->dev, "Missing SDMMC description in devicetree\n");
return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment