aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-05-17 05:47:48 -0400
committerRichard Purdie <rpurdie@linux.intel.com>2010-05-26 08:07:55 -0400
commit7e1ce34f25c984a93dc0a2d8c217f7f78516b376 (patch)
tree9c34d31b78f255e6ff00107075ca340c09ba8970
parent569762ef3dcf8fc5aecdb059d8c0741b90fe1d17 (diff)
leds: leds-lp3944: properly handle lp3944_configure fail in lp3944_probe
In current implementation, lp3944_probe return 0 even if lp3944_configure fail. Therefore, led_classdev_unregister will be executed twice ( in error handling of lp3944_configure and lp3944_remove ). This patch properly handles lp3944_configure fail in lp3944_probe. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Antonio Ospite <ospite@studenti.unina.it> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r--drivers/leds/leds-lp3944.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/leds/leds-lp3944.c b/drivers/leds/leds-lp3944.c
index 8d5ecceba181..932a58da76c4 100644
--- a/drivers/leds/leds-lp3944.c
+++ b/drivers/leds/leds-lp3944.c
@@ -379,6 +379,7 @@ static int __devinit lp3944_probe(struct i2c_client *client,
379{ 379{
380 struct lp3944_platform_data *lp3944_pdata = client->dev.platform_data; 380 struct lp3944_platform_data *lp3944_pdata = client->dev.platform_data;
381 struct lp3944_data *data; 381 struct lp3944_data *data;
382 int err;
382 383
383 if (lp3944_pdata == NULL) { 384 if (lp3944_pdata == NULL) {
384 dev_err(&client->dev, "no platform data\n"); 385 dev_err(&client->dev, "no platform data\n");
@@ -401,9 +402,13 @@ static int __devinit lp3944_probe(struct i2c_client *client,
401 402
402 mutex_init(&data->lock); 403 mutex_init(&data->lock);
403 404
404 dev_info(&client->dev, "lp3944 enabled\n"); 405 err = lp3944_configure(client, data, lp3944_pdata);
406 if (err < 0) {
407 kfree(data);
408 return err;
409 }
405 410
406 lp3944_configure(client, data, lp3944_pdata); 411 dev_info(&client->dev, "lp3944 enabled\n");
407 return 0; 412 return 0;
408} 413}
409 414