Skip to content

Commit

Permalink
gpio: palmas: fix a possible NULL dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
LABBE Corentin authored and Linus Walleij committed Nov 17, 2015
1 parent 853f0cb commit 5664de2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpio/gpio-palmas.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ static int palmas_gpio_probe(struct platform_device *pdev)
const struct palmas_device_data *dev_data;

match = of_match_device(of_palmas_gpio_match, &pdev->dev);
if (!match)
return -ENODEV;
dev_data = match->data;
if (!dev_data)
dev_data = &palmas_dev_data;
Expand Down

0 comments on commit 5664de2

Please sign in to comment.