diff options
author | Jingoo Han <jg1.han@samsung.com> | 2012-05-29 18:07:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 19:22:30 -0400 |
commit | 9828eb09bf5a450bd40a6931a751a122a4c66e2b (patch) | |
tree | 000650dd637be1042773e27cd643c126fd2536f9 /drivers/video | |
parent | 06c96f189bf94448779db66944836a827517d6c9 (diff) |
backlight: ili9320: 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>
Cc: Ben Dooks <ben-linux@fluff.org>
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/video')
-rw-r--r-- | drivers/video/backlight/ili9320.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/video/backlight/ili9320.c b/drivers/video/backlight/ili9320.c index 5118a9f029ab..6c9399341bcf 100644 --- a/drivers/video/backlight/ili9320.c +++ b/drivers/video/backlight/ili9320.c | |||
@@ -220,7 +220,7 @@ int __devinit ili9320_probe_spi(struct spi_device *spi, | |||
220 | 220 | ||
221 | /* allocate and initialse our state */ | 221 | /* allocate and initialse our state */ |
222 | 222 | ||
223 | ili = kzalloc(sizeof(struct ili9320), GFP_KERNEL); | 223 | ili = devm_kzalloc(&spi->dev, sizeof(struct ili9320), GFP_KERNEL); |
224 | if (ili == NULL) { | 224 | if (ili == NULL) { |
225 | dev_err(dev, "no memory for device\n"); | 225 | dev_err(dev, "no memory for device\n"); |
226 | return -ENOMEM; | 226 | return -ENOMEM; |
@@ -240,8 +240,7 @@ int __devinit ili9320_probe_spi(struct spi_device *spi, | |||
240 | lcd = lcd_device_register("ili9320", dev, ili, &ili9320_ops); | 240 | lcd = lcd_device_register("ili9320", dev, ili, &ili9320_ops); |
241 | if (IS_ERR(lcd)) { | 241 | if (IS_ERR(lcd)) { |
242 | dev_err(dev, "failed to register lcd device\n"); | 242 | dev_err(dev, "failed to register lcd device\n"); |
243 | ret = PTR_ERR(lcd); | 243 | return PTR_ERR(lcd); |
244 | goto err_free; | ||
245 | } | 244 | } |
246 | 245 | ||
247 | ili->lcd = lcd; | 246 | ili->lcd = lcd; |
@@ -259,9 +258,6 @@ int __devinit ili9320_probe_spi(struct spi_device *spi, | |||
259 | err_unregister: | 258 | err_unregister: |
260 | lcd_device_unregister(lcd); | 259 | lcd_device_unregister(lcd); |
261 | 260 | ||
262 | err_free: | ||
263 | kfree(ili); | ||
264 | |||
265 | return ret; | 261 | return ret; |
266 | } | 262 | } |
267 | 263 | ||
@@ -272,7 +268,6 @@ int __devexit ili9320_remove(struct ili9320 *ili) | |||
272 | ili9320_power(ili, FB_BLANK_POWERDOWN); | 268 | ili9320_power(ili, FB_BLANK_POWERDOWN); |
273 | 269 | ||
274 | lcd_device_unregister(ili->lcd); | 270 | lcd_device_unregister(ili->lcd); |
275 | kfree(ili); | ||
276 | 271 | ||
277 | return 0; | 272 | return 0; |
278 | } | 273 | } |