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
60d613d6aef4ae49988eeb3ad38af948c561db1e)
Change-Id: I7fc9742e69aacbe3f7cef1c56bbd35b4ca72720e
Signed-off-by: David Wu <david.wu@rock-chips.com>
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;
}