]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
Regulator: core: Unregister when gpio request fails.
authorAndrew Lunn <andrew@lunn.ch>
Sun, 28 Oct 2012 15:01:11 +0000 (16:01 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 28 Oct 2012 18:13:07 +0000 (18:13 +0000)
If the gpio_request_one() fails, or returns EPROBE_DEFER, the
regulator must be device_unregister()ed. When this is not done,
there are WARNING: from sysfs:

WARNING: at fs/sysfs/file.c:343 sysfs_open_file+0x238/0x268()

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/core.c

index 5c4829cba6a62de6168c6bb3c4913812e5e8b4e1..aa4d28b5984e9ea6ebd5bd95383e2885a749cfe6 100644 (file)
@@ -3365,7 +3365,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
                if (ret != 0) {
                        rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
                                 config->ena_gpio, ret);
-                       goto clean;
+                       goto wash;
                }
 
                rdev->ena_gpio = config->ena_gpio;
@@ -3449,6 +3449,7 @@ scrub:
        if (rdev->ena_gpio)
                gpio_free(rdev->ena_gpio);
        kfree(rdev->constraints);
+wash:
        device_unregister(&rdev->dev);
        /* device core frees rdev */
        rdev = ERR_PTR(ret);