Skip to content

Commit

Permalink
pinctrl: nomadik: Prevent NULL dereference if of_match_device returns…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Axel Lin authored and Linus Walleij committed Nov 15, 2012
1 parent e7ed671 commit 953e9e9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/pinctrl/pinctrl-nomadik.c
Original file line number Diff line number Diff line change
Expand Up @@ -1864,9 +1864,14 @@ static int __devinit nmk_pinctrl_probe(struct platform_device *pdev)

if (platid)
version = platid->driver_data;
else if (np)
version = (unsigned int)
of_match_device(nmk_pinctrl_match, &pdev->dev)->data;
else if (np) {
const struct of_device_id *match;

match = of_match_device(nmk_pinctrl_match, &pdev->dev);
if (!match)
return -ENODEV;
version = (unsigned int) match->data;
}

/* Poke in other ASIC variants here */
if (version == PINCTRL_NMK_STN8815)
Expand Down

0 comments on commit 953e9e9

Please sign in to comment.