diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-03-23 15:02:07 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 16:58:34 -0700 |
commit | 920c4f4c3651855f888ec708ecc656ba10dd8f1d (patch) | |
tree | 2c8f540641caba6b9b95b337d06cd3b9e644f603 /drivers/leds | |
parent | 3a2fd4a14112452eb5c1a079ac8b3f4842762afe (diff) | |
download | linux-920c4f4c3651855f888ec708ecc656ba10dd8f1d.tar.gz linux-920c4f4c3651855f888ec708ecc656ba10dd8f1d.tar.bz2 linux-920c4f4c3651855f888ec708ecc656ba10dd8f1d.zip |
drivers/leds/leds-tca6507.c: cleanup error handling in tca6507_probe()
Just a small tidy-up.
1) There is a NULL dereference if the tca allocation fails.
2) The call to cancel_work_sync() isn't needed because we haven't
scheduled any work.
3) The call to i2c_set_clientdata() isn't needed because the core
handles that automatically if probe() fails.
4) I added some curly braces for style reasons.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Acked-by: NeilBrown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/leds')
-rw-r--r-- | drivers/leds/leds-tca6507.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c index 133f89fb7071..ec06a8101e56 100644 --- a/drivers/leds/leds-tca6507.c +++ b/drivers/leds/leds-tca6507.c @@ -687,10 +687,9 @@ static int __devinit tca6507_probe(struct i2c_client *client, NUM_LEDS); return -ENODEV; } - err = -ENOMEM; tca = kzalloc(sizeof(*tca), GFP_KERNEL); if (!tca) - goto exit; + return -ENOMEM; tca->client = client; INIT_WORK(&tca->work, tca6507_work); @@ -724,11 +723,10 @@ static int __devinit tca6507_probe(struct i2c_client *client, return 0; exit: - while (i--) + while (i--) { if (tca->leds[i].led_cdev.name) led_classdev_unregister(&tca->leds[i].led_cdev); - cancel_work_sync(&tca->work); - i2c_set_clientdata(client, NULL); + } kfree(tca); return err; } |