summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-palmas.c
diff options
context:
space:
mode:
authorLABBE Corentin <clabbe.montjoie@gmail.com>2015-11-11 23:27:36 +0300
committerLinus Walleij <linus.walleij@linaro.org>2015-11-17 16:40:24 +0300
commit5664de25fa8ad2f06d6d7dd44df61023e1aaaa14 (patch)
tree49157661585b85faa62ca2a960258f601e94b3c1 /drivers/gpio/gpio-palmas.c
parent853f0cb8603486a8ba17d5b728b52a9b4b029698 (diff)
downloadlinux-5664de25fa8ad2f06d6d7dd44df61023e1aaaa14.tar.xz
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>
Diffstat (limited to 'drivers/gpio/gpio-palmas.c')
-rw-r--r--drivers/gpio/gpio-palmas.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c
index 171a6389f9ce..52b447c071cb 100644
--- a/drivers/gpio/gpio-palmas.c
+++ b/drivers/gpio/gpio-palmas.c
@@ -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;