]> Git Repo - J-linux.git/commitdiff
gpio: mockup: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <[email protected]>
Wed, 26 Jun 2019 08:45:57 +0000 (10:45 +0200)
committerBartosz Golaszewski <[email protected]>
Thu, 27 Jun 2019 13:54:19 +0000 (15:54 +0200)
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Bamvor Jian Zhang <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Bartosz Golaszewski <[email protected]>
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
[Bartosz: removed one more check for debugfs return value]
Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
drivers/gpio/gpio-mockup.c

index b6a4efce7c9285f0a26411246d615c90f498d0be..f1a9c0544e3f7f5fc63c8f87298c5630c3254e4b 100644 (file)
@@ -315,7 +315,6 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
                                      struct gpio_mockup_chip *chip)
 {
        struct gpio_mockup_dbgfs_private *priv;
-       struct dentry *evfile;
        struct gpio_chip *gc;
        const char *devname;
        char *name;
@@ -325,32 +324,25 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
        devname = dev_name(&gc->gpiodev->dev);
 
        chip->dbg_dir = debugfs_create_dir(devname, gpio_mockup_dbg_dir);
-       if (IS_ERR_OR_NULL(chip->dbg_dir))
-               goto err;
 
        for (i = 0; i < gc->ngpio; i++) {
                name = devm_kasprintf(dev, GFP_KERNEL, "%d", i);
                if (!name)
-                       goto err;
+                       return;
 
                priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
                if (!priv)
-                       goto err;
+                       return;
 
                priv->chip = chip;
                priv->offset = i;
                priv->desc = &gc->gpiodev->descs[i];
 
-               evfile = debugfs_create_file(name, 0200, chip->dbg_dir, priv,
-                                            &gpio_mockup_debugfs_ops);
-               if (IS_ERR_OR_NULL(evfile))
-                       goto err;
+               debugfs_create_file(name, 0200, chip->dbg_dir, priv,
+                                   &gpio_mockup_debugfs_ops);
        }
 
        return;
-
-err:
-       dev_err(dev, "error creating debugfs files\n");
 }
 
 static int gpio_mockup_name_lines(struct device *dev,
@@ -447,8 +439,7 @@ static int gpio_mockup_probe(struct platform_device *pdev)
        if (rv)
                return rv;
 
-       if (!IS_ERR_OR_NULL(gpio_mockup_dbg_dir))
-               gpio_mockup_debugfs_setup(dev, chip);
+       gpio_mockup_debugfs_setup(dev, chip);
 
        return 0;
 }
@@ -501,8 +492,6 @@ static int __init gpio_mockup_init(void)
        }
 
        gpio_mockup_dbg_dir = debugfs_create_dir("gpio-mockup", NULL);
-       if (IS_ERR_OR_NULL(gpio_mockup_dbg_dir))
-               gpio_mockup_err("error creating debugfs directory\n");
 
        err = platform_driver_register(&gpio_mockup_driver);
        if (err) {
This page took 0.054177 seconds and 4 git commands to generate.