aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/leds/leds-88pm860x.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/leds/leds-88pm860x.c b/drivers/leds/leds-88pm860x.c
index 5b61aaf7ac0f..61897cfeeda6 100644
--- a/drivers/leds/leds-88pm860x.c
+++ b/drivers/leds/leds-88pm860x.c
@@ -209,7 +209,7 @@ static int pm860x_led_probe(struct platform_device *pdev)
209 return -EINVAL; 209 return -EINVAL;
210 } 210 }
211 211
212 data = kzalloc(sizeof(struct pm860x_led), GFP_KERNEL); 212 data = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_led), GFP_KERNEL);
213 if (data == NULL) 213 if (data == NULL)
214 return -ENOMEM; 214 return -ENOMEM;
215 strncpy(data->name, res->name, MFD_NAME_SIZE - 1); 215 strncpy(data->name, res->name, MFD_NAME_SIZE - 1);
@@ -220,7 +220,6 @@ static int pm860x_led_probe(struct platform_device *pdev)
220 data->port = pdata->flags; 220 data->port = pdata->flags;
221 if (data->port < 0) { 221 if (data->port < 0) {
222 dev_err(&pdev->dev, "check device failed\n"); 222 dev_err(&pdev->dev, "check device failed\n");
223 kfree(data);
224 return -EINVAL; 223 return -EINVAL;
225 } 224 }
226 225
@@ -233,13 +232,10 @@ static int pm860x_led_probe(struct platform_device *pdev)
233 ret = led_classdev_register(chip->dev, &data->cdev); 232 ret = led_classdev_register(chip->dev, &data->cdev);
234 if (ret < 0) { 233 if (ret < 0) {
235 dev_err(&pdev->dev, "Failed to register LED: %d\n", ret); 234 dev_err(&pdev->dev, "Failed to register LED: %d\n", ret);
236 goto out; 235 return ret;
237 } 236 }
238 pm860x_led_set(&data->cdev, 0); 237 pm860x_led_set(&data->cdev, 0);
239 return 0; 238 return 0;
240out:
241 kfree(data);
242 return ret;
243} 239}
244 240
245static int pm860x_led_remove(struct platform_device *pdev) 241static int pm860x_led_remove(struct platform_device *pdev)
@@ -247,7 +243,6 @@ static int pm860x_led_remove(struct platform_device *pdev)
247 struct pm860x_led *data = platform_get_drvdata(pdev); 243 struct pm860x_led *data = platform_get_drvdata(pdev);
248 244
249 led_classdev_unregister(&data->cdev); 245 led_classdev_unregister(&data->cdev);
250 kfree(data);
251 246
252 return 0; 247 return 0;
253} 248}