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

backlight: tosa_lcd: 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: Dmitry Baryshkov <dbaryshkov@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f072c890
......@@ -174,7 +174,8 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)
int ret;
struct tosa_lcd_data *data;
data = kzalloc(sizeof(struct tosa_lcd_data), GFP_KERNEL);
data = devm_kzalloc(&spi->dev, sizeof(struct tosa_lcd_data),
GFP_KERNEL);
if (!data)
return -ENOMEM;
......@@ -187,7 +188,7 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)
ret = spi_setup(spi);
if (ret < 0)
goto err_spi;
return ret;
data->spi = spi;
dev_set_drvdata(&spi->dev, data);
......@@ -224,8 +225,6 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)
gpio_free(TOSA_GPIO_TG_ON);
err_gpio_tg:
dev_set_drvdata(&spi->dev, NULL);
err_spi:
kfree(data);
return ret;
}
......@@ -242,7 +241,6 @@ static int __devexit tosa_lcd_remove(struct spi_device *spi)
gpio_free(TOSA_GPIO_TG_ON);
dev_set_drvdata(&spi->dev, NULL);
kfree(data);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册