Skip to content

Commit

Permalink
leds: leds-lp3944: properly handle lp3944_configure fail in lp3944_probe
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Axel Lin authored and Richard Purdie committed May 26, 2010
1 parent 569762e commit 7e1ce34
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/leds/leds-lp3944.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ static int __devinit lp3944_probe(struct i2c_client *client,
{
struct lp3944_platform_data *lp3944_pdata = client->dev.platform_data;
struct lp3944_data *data;
int err;

if (lp3944_pdata == NULL) {
dev_err(&client->dev, "no platform data\n");
Expand All @@ -401,9 +402,13 @@ static int __devinit lp3944_probe(struct i2c_client *client,

mutex_init(&data->lock);

dev_info(&client->dev, "lp3944 enabled\n");
err = lp3944_configure(client, data, lp3944_pdata);
if (err < 0) {
kfree(data);
return err;
}

lp3944_configure(client, data, lp3944_pdata);
dev_info(&client->dev, "lp3944 enabled\n");
return 0;
}

Expand Down

0 comments on commit 7e1ce34

Please sign in to comment.