Thread (28 messages) 28 messages, 6 authors, 2012-07-09

Re: [PATCH] pwm-backlight: add regulator and GPIO support

From: Sascha Hauer <s.hauer@pengutronix.de>
Date: 2012-07-04 13:01:04
Also in: linux-tegra, lkml

On Wed, Jul 04, 2012 at 09:26:58PM +0900, Alex Courbot wrote:
Hi Sascha,

On 07/04/2012 07:48 PM, Sascha Hauer wrote:>> +
quoted
quoted
+	pb->power_reg = devm_regulator_get(&pdev->dev, "power");
+	if (IS_ERR(pb->power_reg))
+		return PTR_ERR(pb->power_reg);
This looses several resources allocated earlier, like the enable gpio
and the pwm. This is really bad here since I have no regulator specified
and devm_regulator_get returns with -EPROBE_DEFER. Next time the core
tries to probe the driver the driver bails out because the gpio and the
pwm is already requested.
That's very bad indeed. I assumed that the kernel would free
devm-allocated resources after probe returned -EPROBE_DEFER,
It indeed does free devm allocated resources, but neither the gpio nor
the pwm are devm allocated.

Also please be aware that using a regulator in the pwm backlight will
instantly break all existing users. That's hardly your fault though.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help