提交 953e9e93 编写于 作者: A Axel Lin 提交者: Linus Walleij

pinctrl: nomadik: Prevent NULL dereference if of_match_device returns NULL

of_match_device() may return NULL.
Signed-off-by: NAxel Lin <axel.lin@ingics.com>
Acked-by: NLee Jones <lee.jones@linaro.org>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 e7ed6718
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册