diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-07-03 07:47:53 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@canonical.com> | 2012-07-23 19:52:36 -0400 |
commit | 0b7da746cc5fdbdb7b52bf6faa9bb06bb0dd7869 (patch) | |
tree | dce7c43ea0d95fc011450fcc5081249a320ab6df /drivers/leds/leds-pwm.c | |
parent | 7fafefb86e4d48464b79c125b37b9d472ba253ab (diff) |
leds: Use devm_kzalloc in leds-pwm.c file
devm_kzalloc() makes cleanup simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'drivers/leds/leds-pwm.c')
-rw-r--r-- | drivers/leds/leds-pwm.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c index 3ed92f34bd44..f2e44c719437 100644 --- a/drivers/leds/leds-pwm.c +++ b/drivers/leds/leds-pwm.c | |||
@@ -57,7 +57,8 @@ static int led_pwm_probe(struct platform_device *pdev) | |||
57 | if (!pdata) | 57 | if (!pdata) |
58 | return -EBUSY; | 58 | return -EBUSY; |
59 | 59 | ||
60 | leds_data = kzalloc(sizeof(struct led_pwm_data) * pdata->num_leds, | 60 | leds_data = devm_kzalloc(&pdev->dev, |
61 | sizeof(struct led_pwm_data) * pdata->num_leds, | ||
61 | GFP_KERNEL); | 62 | GFP_KERNEL); |
62 | if (!leds_data) | 63 | if (!leds_data) |
63 | return -ENOMEM; | 64 | return -ENOMEM; |
@@ -103,8 +104,6 @@ err: | |||
103 | } | 104 | } |
104 | } | 105 | } |
105 | 106 | ||
106 | kfree(leds_data); | ||
107 | |||
108 | return ret; | 107 | return ret; |
109 | } | 108 | } |
110 | 109 | ||
@@ -121,8 +120,6 @@ static int __devexit led_pwm_remove(struct platform_device *pdev) | |||
121 | pwm_free(leds_data[i].pwm); | 120 | pwm_free(leds_data[i].pwm); |
122 | } | 121 | } |
123 | 122 | ||
124 | kfree(leds_data); | ||
125 | |||
126 | return 0; | 123 | return 0; |
127 | } | 124 | } |
128 | 125 | ||