diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2014-02-25 04:48:20 -0500 |
---|---|---|
committer | Chris Ball <chris@printf.net> | 2014-02-25 15:42:33 -0500 |
commit | 43aaa50f17c38c16cce2a9a3e73909b7937892a3 (patch) | |
tree | 7fd690f9f67a2bbcc072c692cf582b84862d2376 | |
parent | c4c7fb19bbf1129da1c3b9fcad9713bd79f3207c (diff) |
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>
-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) | |||
757 | struct device_node *np = pdev->dev.of_node; | 757 | struct device_node *np = pdev->dev.of_node; |
758 | const struct of_device_id *of_id = | 758 | const struct of_device_id *of_id = |
759 | of_match_device(wmt_mci_dt_ids, &pdev->dev); | 759 | of_match_device(wmt_mci_dt_ids, &pdev->dev); |
760 | const struct wmt_mci_caps *wmt_caps = of_id->data; | 760 | const struct wmt_mci_caps *wmt_caps; |
761 | int ret; | 761 | int ret; |
762 | int regular_irq, dma_irq; | 762 | int regular_irq, dma_irq; |
763 | 763 | ||
@@ -766,6 +766,8 @@ static int wmt_mci_probe(struct platform_device *pdev) | |||
766 | return -EFAULT; | 766 | return -EFAULT; |
767 | } | 767 | } |
768 | 768 | ||
769 | wmt_caps = of_id->data; | ||
770 | |||
769 | if (!np) { | 771 | if (!np) { |
770 | dev_err(&pdev->dev, "Missing SDMMC description in devicetree\n"); | 772 | dev_err(&pdev->dev, "Missing SDMMC description in devicetree\n"); |
771 | return -EFAULT; | 773 | return -EFAULT; |