aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2012-05-29 18:07:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:31 -0400
commitf072c8900c11bc91eb3fa9287bab4ce606632be5 (patch)
treed0301ae9b4d5089f1c9104c0d9c44de82ef7e982 /drivers/video
parentd073adc5caf03a928a230baf2d8a86b1f9a03710 (diff)
backlight: tosa_bl: 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: Dmitry Baryshkov <dbaryshkov@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/video')
-rw-r--r--drivers/video/backlight/tosa_bl.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c
index 2b241abced43..0d54e607e82d 100644
--- a/drivers/video/backlight/tosa_bl.c
+++ b/drivers/video/backlight/tosa_bl.c
@@ -82,8 +82,11 @@ static int __devinit tosa_bl_probe(struct i2c_client *client,
82 const struct i2c_device_id *id) 82 const struct i2c_device_id *id)
83{ 83{
84 struct backlight_properties props; 84 struct backlight_properties props;
85 struct tosa_bl_data *data = kzalloc(sizeof(struct tosa_bl_data), GFP_KERNEL); 85 struct tosa_bl_data *data;
86 int ret = 0; 86 int ret = 0;
87
88 data = devm_kzalloc(&client->dev, sizeof(struct tosa_bl_data),
89 GFP_KERNEL);
87 if (!data) 90 if (!data)
88 return -ENOMEM; 91 return -ENOMEM;
89 92
@@ -92,7 +95,7 @@ static int __devinit tosa_bl_probe(struct i2c_client *client,
92 ret = gpio_request(TOSA_GPIO_BL_C20MA, "backlight"); 95 ret = gpio_request(TOSA_GPIO_BL_C20MA, "backlight");
93 if (ret) { 96 if (ret) {
94 dev_dbg(&data->bl->dev, "Unable to request gpio!\n"); 97 dev_dbg(&data->bl->dev, "Unable to request gpio!\n");
95 goto err_gpio_bl; 98 return ret;
96 } 99 }
97 ret = gpio_direction_output(TOSA_GPIO_BL_C20MA, 0); 100 ret = gpio_direction_output(TOSA_GPIO_BL_C20MA, 0);
98 if (ret) 101 if (ret)
@@ -122,8 +125,6 @@ err_reg:
122 data->bl = NULL; 125 data->bl = NULL;
123err_gpio_dir: 126err_gpio_dir:
124 gpio_free(TOSA_GPIO_BL_C20MA); 127 gpio_free(TOSA_GPIO_BL_C20MA);
125err_gpio_bl:
126 kfree(data);
127 return ret; 128 return ret;
128} 129}
129 130
@@ -136,8 +137,6 @@ static int __devexit tosa_bl_remove(struct i2c_client *client)
136 137
137 gpio_free(TOSA_GPIO_BL_C20MA); 138 gpio_free(TOSA_GPIO_BL_C20MA);
138 139
139 kfree(data);
140
141 return 0; 140 return 0;
142} 141}
143 142