diff options
author | Jingoo Han <jg1.han@samsung.com> | 2012-05-29 18:07:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 19:22:30 -0400 |
commit | 26f2b35c1e1463c851be23c9774bd24caae7b517 (patch) | |
tree | 0375fa93d35ba4f5d146e34f0c0b3fa303678a82 /drivers | |
parent | 86f6be4fae7aeaeb038dc809b232ebe76b2e1dd2 (diff) |
backlight: lms283gf05: use devm_ functions
The devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_kzalloc of these functions.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/backlight/lms283gf05.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c index 4161f9e3982a..a9f2c36966f1 100644 --- a/drivers/video/backlight/lms283gf05.c +++ b/drivers/video/backlight/lms283gf05.c | |||
@@ -168,7 +168,8 @@ static int __devinit lms283gf05_probe(struct spi_device *spi) | |||
168 | goto err; | 168 | goto err; |
169 | } | 169 | } |
170 | 170 | ||
171 | st = kzalloc(sizeof(struct lms283gf05_state), GFP_KERNEL); | 171 | st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state), |
172 | GFP_KERNEL); | ||
172 | if (st == NULL) { | 173 | if (st == NULL) { |
173 | dev_err(&spi->dev, "No memory for device state\n"); | 174 | dev_err(&spi->dev, "No memory for device state\n"); |
174 | ret = -ENOMEM; | 175 | ret = -ENOMEM; |
@@ -178,7 +179,7 @@ static int __devinit lms283gf05_probe(struct spi_device *spi) | |||
178 | ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops); | 179 | ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops); |
179 | if (IS_ERR(ld)) { | 180 | if (IS_ERR(ld)) { |
180 | ret = PTR_ERR(ld); | 181 | ret = PTR_ERR(ld); |
181 | goto err2; | 182 | goto err; |
182 | } | 183 | } |
183 | 184 | ||
184 | st->spi = spi; | 185 | st->spi = spi; |
@@ -193,8 +194,6 @@ static int __devinit lms283gf05_probe(struct spi_device *spi) | |||
193 | 194 | ||
194 | return 0; | 195 | return 0; |
195 | 196 | ||
196 | err2: | ||
197 | kfree(st); | ||
198 | err: | 197 | err: |
199 | if (pdata != NULL) | 198 | if (pdata != NULL) |
200 | gpio_free(pdata->reset_gpio); | 199 | gpio_free(pdata->reset_gpio); |
@@ -212,8 +211,6 @@ static int __devexit lms283gf05_remove(struct spi_device *spi) | |||
212 | if (pdata != NULL) | 211 | if (pdata != NULL) |
213 | gpio_free(pdata->reset_gpio); | 212 | gpio_free(pdata->reset_gpio); |
214 | 213 | ||
215 | kfree(st); | ||
216 | |||
217 | return 0; | 214 | return 0; |
218 | } | 215 | } |
219 | 216 | ||