[linux-yocto] [PATCH 03/10] UPSTREAM: backlight: pwm_bl: Free PWM requested by legacy API on error path

California Sullivan california.l.sullivan at intel.com
Thu Jul 21 16:47:03 PDT 2016


From: Vladimir Zapolskiy <vladimir_zapolskiy at mentor.com>

If pwm is requested by legacy pwm_request() and if the following
backlight_device_register() call fails, add pwm_free() clean-up.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy at mentor.com>
Signed-off-by: Lee Jones <lee.jones at linaro.org>
(cherry picked from commit 60d613d6aef4ae49988eeb3ad38af948c561db1e)
Signed-off-by: California Sullivan <california.l.sullivan at intel.com>
---
 drivers/video/backlight/pwm_bl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index a22c1ec..64f9e1b 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -328,6 +328,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 	if (IS_ERR(bl)) {
 		dev_err(&pdev->dev, "failed to register backlight\n");
 		ret = PTR_ERR(bl);
+		if (pb->legacy)
+			pwm_free(pb->pwm);
 		goto err_alloc;
 	}
 
-- 
2.5.5



More information about the linux-yocto mailing list