diff options
author | Bryan Wu <bryan.wu@canonical.com> | 2012-07-03 23:51:51 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@canonical.com> | 2012-07-23 19:52:38 -0400 |
commit | 0a8d9d4a61d8c7d6ea00835c814a678ba488b8aa (patch) | |
tree | febda328508a3c565059aa7f78877264a1b79a0c /drivers/leds/leds-lt3593.c | |
parent | bfe4c0419397ffe33ed7accf1729a95737e7ee9e (diff) |
leds: convert LT3593 LED driver to devm_kzalloc()
Cc: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'drivers/leds/leds-lt3593.c')
-rw-r--r-- | drivers/leds/leds-lt3593.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c index e311a96c4469..09a732217f6d 100644 --- a/drivers/leds/leds-lt3593.c +++ b/drivers/leds/leds-lt3593.c | |||
@@ -149,8 +149,9 @@ static int __devinit lt3593_led_probe(struct platform_device *pdev) | |||
149 | if (!pdata) | 149 | if (!pdata) |
150 | return -EBUSY; | 150 | return -EBUSY; |
151 | 151 | ||
152 | leds_data = kzalloc(sizeof(struct lt3593_led_data) * pdata->num_leds, | 152 | leds_data = devm_kzalloc(&pdev->dev, |
153 | GFP_KERNEL); | 153 | sizeof(struct lt3593_led_data) * pdata->num_leds, |
154 | GFP_KERNEL); | ||
154 | if (!leds_data) | 155 | if (!leds_data) |
155 | return -ENOMEM; | 156 | return -ENOMEM; |
156 | 157 | ||
@@ -169,8 +170,6 @@ err: | |||
169 | for (i = i - 1; i >= 0; i--) | 170 | for (i = i - 1; i >= 0; i--) |
170 | delete_lt3593_led(&leds_data[i]); | 171 | delete_lt3593_led(&leds_data[i]); |
171 | 172 | ||
172 | kfree(leds_data); | ||
173 | |||
174 | return ret; | 173 | return ret; |
175 | } | 174 | } |
176 | 175 | ||
@@ -185,8 +184,6 @@ static int __devexit lt3593_led_remove(struct platform_device *pdev) | |||
185 | for (i = 0; i < pdata->num_leds; i++) | 184 | for (i = 0; i < pdata->num_leds; i++) |
186 | delete_lt3593_led(&leds_data[i]); | 185 | delete_lt3593_led(&leds_data[i]); |
187 | 186 | ||
188 | kfree(leds_data); | ||
189 | |||
190 | return 0; | 187 | return 0; |
191 | } | 188 | } |
192 | 189 | ||