From: Vladimir Zapolskiy Date: Sun, 14 Jun 2015 14:32:14 +0000 (+0300) Subject: UPSTREAM: backlight: pwm_bl: Free PWM requested by legacy API on error path X-Git-Tag: firefly_0821_release~452 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8c232cdec7ff531e5cb12cde076ac99f06ae7c34;p=firefly-linux-kernel-4.4.55.git 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 Signed-off-by: Lee Jones (cherry picked from commit 60d613d6aef4ae49988eeb3ad38af948c561db1e) Change-Id: I7fc9742e69aacbe3f7cef1c56bbd35b4ca72720e Signed-off-by: David Wu --- diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index a22c1ec29de7..64f9e1b8655f 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; }