]> Pileus Git - ~andy/linux/blobdiff - drivers/video/backlight/pwm_bl.c
Merge tag 'v3.4-rc6' into gpio/next
[~andy/linux] / drivers / video / backlight / pwm_bl.c
index 7496d04e1d3c1fcda109ae04d12e79c24edacc0e..342b7d7cbb632826611f856a7eaa578220d16681 100644 (file)
@@ -102,7 +102,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
                        return ret;
        }
 
-       pb = kzalloc(sizeof(*pb), GFP_KERNEL);
+       pb = devm_kzalloc(&pdev->dev, sizeof(*pb), GFP_KERNEL);
        if (!pb) {
                dev_err(&pdev->dev, "no memory for state\n");
                ret = -ENOMEM;
@@ -121,7 +121,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
        if (IS_ERR(pb->pwm)) {
                dev_err(&pdev->dev, "unable to request PWM for backlight\n");
                ret = PTR_ERR(pb->pwm);
-               goto err_pwm;
+               goto err_alloc;
        } else
                dev_dbg(&pdev->dev, "got pwm for backlight\n");
 
@@ -144,8 +144,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 
 err_bl:
        pwm_free(pb->pwm);
-err_pwm:
-       kfree(pb);
 err_alloc:
        if (data->exit)
                data->exit(&pdev->dev);
@@ -162,7 +160,6 @@ static int pwm_backlight_remove(struct platform_device *pdev)
        pwm_config(pb->pwm, 0, pb->period);
        pwm_disable(pb->pwm);
        pwm_free(pb->pwm);
-       kfree(pb);
        if (data->exit)
                data->exit(&pdev->dev);
        return 0;