* [PATCH] Regulator: core: Unregister when gpio request fails.
@ 2012-10-28 15:01 Andrew Lunn
2012-10-28 18:15 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Lunn @ 2012-10-28 15:01 UTC (permalink / raw)
To: lrg, broonie; +Cc: linux-kernel, Andrew Lunn
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Regulator: core: Unregister when gpio request fails.
2012-10-28 15:01 [PATCH] Regulator: core: Unregister when gpio request fails Andrew Lunn
@ 2012-10-28 18:15 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-10-28 18:15 UTC (permalink / raw)
To: Andrew Lunn; +Cc: lrg, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 588 bytes --]
On Sun, Oct 28, 2012 at 04:01:11PM +0100, Andrew Lunn wrote:
> 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()
Applied, thanks. Please remember to submit patches with subject lines
that match the subsystem. Also
> + goto wash;
that's a bit too cute and is going to hurt maintainability, meaningful
names are helpful when you get a bunch of things (eg, "clean_gpio").
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-10-28 18:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-28 15:01 [PATCH] Regulator: core: Unregister when gpio request fails Andrew Lunn
2012-10-28 18:15 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).