aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-bd2802.c
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@canonical.com>2012-07-03 23:35:03 -0400
committerBryan Wu <bryan.wu@canonical.com>2012-07-23 19:52:38 -0400
commitac63ff50ad37369b838e1416665ff8ca7e9c9b1b (patch)
tree8cd6c45183623efdf60f221d93b50de0728c9966 /drivers/leds/leds-bd2802.c
parente430dc003f023f3f5244418aa26cc64e78ab8b6e (diff)
leds: convert BD2802 RGB LED driver to devm_kzalloc() and cleanup error exit path
Cc: Kim Kyuwon <q1.kim@samsung.com> Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'drivers/leds/leds-bd2802.c')
-rw-r--r--drivers/leds/leds-bd2802.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/leds/leds-bd2802.c b/drivers/leds/leds-bd2802.c
index 591cbdf5a046..89ca6a2a19d1 100644
--- a/drivers/leds/leds-bd2802.c
+++ b/drivers/leds/leds-bd2802.c
@@ -677,7 +677,7 @@ static int __devinit bd2802_probe(struct i2c_client *client,
677 struct bd2802_led_platform_data *pdata; 677 struct bd2802_led_platform_data *pdata;
678 int ret, i; 678 int ret, i;
679 679
680 led = kzalloc(sizeof(struct bd2802_led), GFP_KERNEL); 680 led = devm_kzalloc(&client->dev, sizeof(struct bd2802_led), GFP_KERNEL);
681 if (!led) { 681 if (!led) {
682 dev_err(&client->dev, "failed to allocate driver data\n"); 682 dev_err(&client->dev, "failed to allocate driver data\n");
683 return -ENOMEM; 683 return -ENOMEM;
@@ -697,7 +697,7 @@ static int __devinit bd2802_probe(struct i2c_client *client,
697 ret = bd2802_write_byte(client, BD2802_REG_CLKSETUP, 0x00); 697 ret = bd2802_write_byte(client, BD2802_REG_CLKSETUP, 0x00);
698 if (ret < 0) { 698 if (ret < 0) {
699 dev_err(&client->dev, "failed to detect device\n"); 699 dev_err(&client->dev, "failed to detect device\n");
700 goto failed_free; 700 return ret;
701 } else 701 } else
702 dev_info(&client->dev, "return 0x%02x\n", ret); 702 dev_info(&client->dev, "return 0x%02x\n", ret);
703 703
@@ -729,9 +729,6 @@ static int __devinit bd2802_probe(struct i2c_client *client,
729failed_unregister_dev_file: 729failed_unregister_dev_file:
730 for (i--; i >= 0; i--) 730 for (i--; i >= 0; i--)
731 device_remove_file(&led->client->dev, bd2802_attributes[i]); 731 device_remove_file(&led->client->dev, bd2802_attributes[i]);
732failed_free:
733 kfree(led);
734
735 return ret; 732 return ret;
736} 733}
737 734
@@ -746,7 +743,6 @@ static int __exit bd2802_remove(struct i2c_client *client)
746 bd2802_disable_adv_conf(led); 743 bd2802_disable_adv_conf(led);
747 for (i = 0; i < ARRAY_SIZE(bd2802_attributes); i++) 744 for (i = 0; i < ARRAY_SIZE(bd2802_attributes); i++)
748 device_remove_file(&led->client->dev, bd2802_attributes[i]); 745 device_remove_file(&led->client->dev, bd2802_attributes[i]);
749 kfree(led);
750 746
751 return 0; 747 return 0;
752} 748}