[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1351436471-17210-1-git-send-email-andrew@lunn.ch>
Date: Sun, 28 Oct 2012 16:01:11 +0100
From: Andrew Lunn <andrew@...n.ch>
To: lrg@...com, broonie@...nsource.wolfsonmicro.com
Cc: linux-kernel@...r.kernel.org, Andrew Lunn <andrew@...n.ch>
Subject: [PATCH] Regulator: core: Unregister when gpio request fails.
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@...n.ch>
---
drivers/regulator/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5c4829c..aa4d28b 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -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);
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists