summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-mockup.c
diff options
context:
space:
mode:
authorBartosz Golaszewski2018-03-04 13:45:51 +0100
committerLinus Walleij2018-03-27 15:18:20 +0200
commit6cb9215baeb9c1ed336a5e8905f7ad7c4698acc9 (patch)
tree2326844d2fc8c9504fc49fdd27d4f0ad2234af1d /drivers/gpio/gpio-mockup.c
parentgpio: pca953x: add compatibility for pcal6524 and pcal9555a (diff)
downloadkernel-qcow2-linux-6cb9215baeb9c1ed336a5e8905f7ad7c4698acc9.tar.gz
kernel-qcow2-linux-6cb9215baeb9c1ed336a5e8905f7ad7c4698acc9.tar.xz
kernel-qcow2-linux-6cb9215baeb9c1ed336a5e8905f7ad7c4698acc9.zip
gpio: mockup: fix a potential crash when creating debugfs entries
If we failed to create the top debugfs directory, we must not try to create the child nodes. We currently only check if gpio_mockup_dbg_dir is not NULL, but it can also contain an errno if debugfs is disabled in build options. Use IS_ERR_OR_NULL() instead. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mockup.c')
-rw-r--r--drivers/gpio/gpio-mockup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index 21422b8e487b..76c2fe91a901 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -314,7 +314,7 @@ static int gpio_mockup_probe(struct platform_device *pdev)
if (rv)
return rv;
- if (gpio_mockup_dbg_dir)
+ if (!IS_ERR_OR_NULL(gpio_mockup_dbg_dir))
gpio_mockup_debugfs_setup(dev, chip);
return 0;