gpio: palmas: fix a possible NULL dereference
of_match_device could return NULL, and so cause a NULL pointer dereference later. Reported-by: coverity (CID 1130700) Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
853f0cb860
commit
5664de25fa
|
@ -167,6 +167,8 @@ static int palmas_gpio_probe(struct platform_device *pdev)
|
||||||
const struct palmas_device_data *dev_data;
|
const struct palmas_device_data *dev_data;
|
||||||
|
|
||||||
match = of_match_device(of_palmas_gpio_match, &pdev->dev);
|
match = of_match_device(of_palmas_gpio_match, &pdev->dev);
|
||||||
|
if (!match)
|
||||||
|
return -ENODEV;
|
||||||
dev_data = match->data;
|
dev_data = match->data;
|
||||||
if (!dev_data)
|
if (!dev_data)
|
||||||
dev_data = &palmas_dev_data;
|
dev_data = &palmas_dev_data;
|
||||||
|
|
Loading…
Reference in New Issue