Commit 6770fc60 authored by Bryan Wu's avatar Bryan Wu

leds: convert TCA6507 LED driver to devm_kzalloc()

Cc: Neil Brown <neilb@suse.de>
Signed-off-by: default avatarBryan Wu <bryan.wu@canonical.com>
parent a44cdd2c
...@@ -687,7 +687,7 @@ static int __devinit tca6507_probe(struct i2c_client *client, ...@@ -687,7 +687,7 @@ static int __devinit tca6507_probe(struct i2c_client *client,
NUM_LEDS); NUM_LEDS);
return -ENODEV; return -ENODEV;
} }
tca = kzalloc(sizeof(*tca), GFP_KERNEL); tca = devm_kzalloc(&client->dev, sizeof(*tca), GFP_KERNEL);
if (!tca) if (!tca)
return -ENOMEM; return -ENOMEM;
...@@ -727,7 +727,6 @@ static int __devinit tca6507_probe(struct i2c_client *client, ...@@ -727,7 +727,6 @@ static int __devinit tca6507_probe(struct i2c_client *client,
if (tca->leds[i].led_cdev.name) if (tca->leds[i].led_cdev.name)
led_classdev_unregister(&tca->leds[i].led_cdev); led_classdev_unregister(&tca->leds[i].led_cdev);
} }
kfree(tca);
return err; return err;
} }
...@@ -743,7 +742,6 @@ static int __devexit tca6507_remove(struct i2c_client *client) ...@@ -743,7 +742,6 @@ static int __devexit tca6507_remove(struct i2c_client *client)
} }
tca6507_remove_gpio(tca); tca6507_remove_gpio(tca);
cancel_work_sync(&tca->work); cancel_work_sync(&tca->work);
kfree(tca);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment