提交 9828eb09 编写于 作者: J Jingoo Han 提交者: Linus Torvalds

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: NJingoo Han <jg1.han@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 06c96f18
...@@ -220,7 +220,7 @@ int __devinit ili9320_probe_spi(struct spi_device *spi, ...@@ -220,7 +220,7 @@ int __devinit ili9320_probe_spi(struct spi_device *spi,
/* allocate and initialse our state */ /* allocate and initialse our state */
ili = kzalloc(sizeof(struct ili9320), GFP_KERNEL); ili = devm_kzalloc(&spi->dev, sizeof(struct ili9320), GFP_KERNEL);
if (ili == NULL) { if (ili == NULL) {
dev_err(dev, "no memory for device\n"); dev_err(dev, "no memory for device\n");
return -ENOMEM; return -ENOMEM;
...@@ -240,8 +240,7 @@ int __devinit ili9320_probe_spi(struct spi_device *spi, ...@@ -240,8 +240,7 @@ int __devinit ili9320_probe_spi(struct spi_device *spi,
lcd = lcd_device_register("ili9320", dev, ili, &ili9320_ops); lcd = lcd_device_register("ili9320", dev, ili, &ili9320_ops);
if (IS_ERR(lcd)) { if (IS_ERR(lcd)) {
dev_err(dev, "failed to register lcd device\n"); dev_err(dev, "failed to register lcd device\n");
ret = PTR_ERR(lcd); return PTR_ERR(lcd);
goto err_free;
} }
ili->lcd = lcd; ili->lcd = lcd;
...@@ -259,9 +258,6 @@ int __devinit ili9320_probe_spi(struct spi_device *spi, ...@@ -259,9 +258,6 @@ int __devinit ili9320_probe_spi(struct spi_device *spi,
err_unregister: err_unregister:
lcd_device_unregister(lcd); lcd_device_unregister(lcd);
err_free:
kfree(ili);
return ret; return ret;
} }
...@@ -272,7 +268,6 @@ int __devexit ili9320_remove(struct ili9320 *ili) ...@@ -272,7 +268,6 @@ int __devexit ili9320_remove(struct ili9320 *ili)
ili9320_power(ili, FB_BLANK_POWERDOWN); ili9320_power(ili, FB_BLANK_POWERDOWN);
lcd_device_unregister(ili->lcd); lcd_device_unregister(ili->lcd);
kfree(ili);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册