diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2014-02-25 15:18:20 +0530 |
---|---|---|
committer | Chris Ball <chris@printf.net> | 2014-02-25 15:42:33 -0500 |
commit | 43aaa50f17c38c16cce2a9a3e73909b7937892a3 (patch) | |
tree | 7fd690f9f67a2bbcc072c692cf582b84862d2376 /drivers/mmc | |
parent | c4c7fb19bbf1129da1c3b9fcad9713bd79f3207c (diff) | |
download | linux-43aaa50f17c38c16cce2a9a3e73909b7937892a3.tar.bz2 |
mmc: wmt-sdmmc: Fix NULL pointer dereference
'of_id' is dereferenced before NULL pointer check. Move it to
after the check.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Chris Ball <chris@printf.net>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/wmt-sdmmc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c index e902ed7846b0..498d1f799085 100644 --- a/drivers/mmc/host/wmt-sdmmc.c +++ b/drivers/mmc/host/wmt-sdmmc.c @@ -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; |