aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/backlight/lms283gf05.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c
index 4161f9e3982a..a9f2c36966f1 100644
--- a/drivers/video/backlight/lms283gf05.c
+++ b/drivers/video/backlight/lms283gf05.c
@@ -168,7 +168,8 @@ static int __devinit lms283gf05_probe(struct spi_device *spi)
168 goto err; 168 goto err;
169 } 169 }
170 170
171 st = kzalloc(sizeof(struct lms283gf05_state), GFP_KERNEL); 171 st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state),
172 GFP_KERNEL);
172 if (st == NULL) { 173 if (st == NULL) {
173 dev_err(&spi->dev, "No memory for device state\n"); 174 dev_err(&spi->dev, "No memory for device state\n");
174 ret = -ENOMEM; 175 ret = -ENOMEM;
@@ -178,7 +179,7 @@ static int __devinit lms283gf05_probe(struct spi_device *spi)
178 ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops); 179 ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops);
179 if (IS_ERR(ld)) { 180 if (IS_ERR(ld)) {
180 ret = PTR_ERR(ld); 181 ret = PTR_ERR(ld);
181 goto err2; 182 goto err;
182 } 183 }
183 184
184 st->spi = spi; 185 st->spi = spi;
@@ -193,8 +194,6 @@ static int __devinit lms283gf05_probe(struct spi_device *spi)
193 194
194 return 0; 195 return 0;
195 196
196err2:
197 kfree(st);
198err: 197err:
199 if (pdata != NULL) 198 if (pdata != NULL)
200 gpio_free(pdata->reset_gpio); 199 gpio_free(pdata->reset_gpio);
@@ -212,8 +211,6 @@ static int __devexit lms283gf05_remove(struct spi_device *spi)
212 if (pdata != NULL) 211 if (pdata != NULL)
213 gpio_free(pdata->reset_gpio); 212 gpio_free(pdata->reset_gpio);
214 213
215 kfree(st);
216
217 return 0; 214 return 0;
218} 215}
219 216