diff options
author | Axel Lin <axel.lin@ingics.com> | 2012-11-14 23:56:05 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-11-15 10:50:15 -0500 |
commit | 953e9e93862871e005bdcde3b98db822d12185a8 (patch) | |
tree | 7000df3e63011dfd6abcb41d3bd1f1788f4020e1 | |
parent | e7ed671825d7d8ee7225a9e1de997d643e6d5d69 (diff) |
pinctrl: nomadik: Prevent NULL dereference if of_match_device returns NULL
of_match_device() may return NULL.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 6a95d0438b6a..98c088ae7f4a 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -1864,9 +1864,14 @@ static int __devinit nmk_pinctrl_probe(struct platform_device *pdev) | |||
1864 | 1864 | ||
1865 | if (platid) | 1865 | if (platid) |
1866 | version = platid->driver_data; | 1866 | version = platid->driver_data; |
1867 | else if (np) | 1867 | else if (np) { |
1868 | version = (unsigned int) | 1868 | const struct of_device_id *match; |
1869 | of_match_device(nmk_pinctrl_match, &pdev->dev)->data; | 1869 | |
1870 | match = of_match_device(nmk_pinctrl_match, &pdev->dev); | ||
1871 | if (!match) | ||
1872 | return -ENODEV; | ||
1873 | version = (unsigned int) match->data; | ||
1874 | } | ||
1870 | 1875 | ||
1871 | /* Poke in other ASIC variants here */ | 1876 | /* Poke in other ASIC variants here */ |
1872 | if (version == PINCTRL_NMK_STN8815) | 1877 | if (version == PINCTRL_NMK_STN8815) |