backlight: pwm_bl: Free PWM requested by legacy API on error path
authorVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Sun, 14 Jun 2015 14:32:14 +0000 (17:32 +0300)
committerLee Jones <lee.jones@linaro.org>
Mon, 11 Jan 2016 10:45:24 +0000 (10:45 +0000)
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>
drivers/video/backlight/pwm_bl.c

index a22c1ec29de754c0de475b38a9785f47c0454c1c..64f9e1b8655f4b29f64f95c6cf9b3a0e9cc04c6d 100644 (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;
        }