提交 0b7da746 编写于 作者: S Sachin Kamat 提交者: Bryan Wu

leds: Use devm_kzalloc in leds-pwm.c file

devm_kzalloc() makes cleanup simpler.
Signed-off-by: NSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: NBryan Wu <bryan.wu@canonical.com>
上级 7fafefb8
...@@ -57,7 +57,8 @@ static int led_pwm_probe(struct platform_device *pdev) ...@@ -57,7 +57,8 @@ static int led_pwm_probe(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -EBUSY; return -EBUSY;
leds_data = kzalloc(sizeof(struct led_pwm_data) * pdata->num_leds, leds_data = devm_kzalloc(&pdev->dev,
sizeof(struct led_pwm_data) * pdata->num_leds,
GFP_KERNEL); GFP_KERNEL);
if (!leds_data) if (!leds_data)
return -ENOMEM; return -ENOMEM;
...@@ -103,8 +104,6 @@ static int led_pwm_probe(struct platform_device *pdev) ...@@ -103,8 +104,6 @@ static int led_pwm_probe(struct platform_device *pdev)
} }
} }
kfree(leds_data);
return ret; return ret;
} }
...@@ -121,8 +120,6 @@ static int __devexit led_pwm_remove(struct platform_device *pdev) ...@@ -121,8 +120,6 @@ static int __devexit led_pwm_remove(struct platform_device *pdev)
pwm_free(leds_data[i].pwm); pwm_free(leds_data[i].pwm);
} }
kfree(leds_data);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册