diff options
| -rw-r--r-- | drivers/leds/leds-pca955x.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c index 5f462dbf0dbb..aef3cf0432fe 100644 --- a/drivers/leds/leds-pca955x.c +++ b/drivers/leds/leds-pca955x.c | |||
| @@ -293,15 +293,14 @@ static int __devinit pca955x_probe(struct i2c_client *client, | |||
| 293 | } | 293 | } |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | pca955x = kzalloc(sizeof(*pca955x), GFP_KERNEL); | 296 | pca955x = devm_kzalloc(&client->dev, sizeof(*pca955x), GFP_KERNEL); |
| 297 | if (!pca955x) | 297 | if (!pca955x) |
| 298 | return -ENOMEM; | 298 | return -ENOMEM; |
| 299 | 299 | ||
| 300 | pca955x->leds = kzalloc(sizeof(*pca955x_led) * chip->bits, GFP_KERNEL); | 300 | pca955x->leds = devm_kzalloc(&client->dev, |
| 301 | if (!pca955x->leds) { | 301 | sizeof(*pca955x_led) * chip->bits, GFP_KERNEL); |
| 302 | err = -ENOMEM; | 302 | if (!pca955x->leds) |
| 303 | goto exit_nomem; | 303 | return -ENOMEM; |
| 304 | } | ||
| 305 | 304 | ||
| 306 | i2c_set_clientdata(client, pca955x); | 305 | i2c_set_clientdata(client, pca955x); |
| 307 | 306 | ||
| @@ -361,10 +360,6 @@ exit: | |||
| 361 | cancel_work_sync(&pca955x->leds[i].work); | 360 | cancel_work_sync(&pca955x->leds[i].work); |
| 362 | } | 361 | } |
| 363 | 362 | ||
| 364 | kfree(pca955x->leds); | ||
| 365 | exit_nomem: | ||
| 366 | kfree(pca955x); | ||
| 367 | |||
| 368 | return err; | 363 | return err; |
| 369 | } | 364 | } |
| 370 | 365 | ||
| @@ -378,9 +373,6 @@ static int __devexit pca955x_remove(struct i2c_client *client) | |||
| 378 | cancel_work_sync(&pca955x->leds[i].work); | 373 | cancel_work_sync(&pca955x->leds[i].work); |
| 379 | } | 374 | } |
| 380 | 375 | ||
| 381 | kfree(pca955x->leds); | ||
| 382 | kfree(pca955x); | ||
| 383 | |||
| 384 | return 0; | 376 | return 0; |
| 385 | } | 377 | } |
| 386 | 378 | ||
