diff options
-rw-r--r-- | drivers/video/backlight/tosa_bl.c | 11 |
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; |
123 | err_gpio_dir: | 126 | err_gpio_dir: |
124 | gpio_free(TOSA_GPIO_BL_C20MA); | 127 | gpio_free(TOSA_GPIO_BL_C20MA); |
125 | err_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 | ||