UPSTREAM: backlight: pwm_bl: Free PWM requested by legacy API on error path

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@mentor.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
(cherry picked from commit 60d613d6ae)

Change-Id: I7fc9742e69aacbe3f7cef1c56bbd35b4ca72720e
Signed-off-by: David Wu <david.wu@rock-chips.com>
This commit is contained in:
Vladimir Zapolskiy
2015-06-14 17:32:14 +03:00
committed by Huang, Tao
parent 9b2f443b1a
commit 8c232cdec7

View File

@@ -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;
}