diff options
author | Mark Brown <broonie@linaro.org> | 2013-07-01 06:17:09 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-07-01 06:17:09 -0400 |
commit | bc830f352e48d24e5c56c6af62ad41829c96015e (patch) | |
tree | 1fdecb3dc615945aec0a47b46544a845e52274bb | |
parent | 0a192cc8600bede44a0425402758631d410a7c6f (diff) | |
parent | 2af0af67354b7c9b17d28e6ab47a8177afec125d (diff) |
Merge remote-tracking branch 'regulator/topic/lp397x' into regulator-next
-rw-r--r-- | drivers/regulator/lp3971.c | 11 | ||||
-rw-r--r-- | drivers/regulator/lp3972.c | 11 |
2 files changed, 6 insertions, 16 deletions
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c index d8af9e773310..3809b4381606 100644 --- a/drivers/regulator/lp3971.c +++ b/drivers/regulator/lp3971.c | |||
@@ -434,7 +434,7 @@ static int lp3971_i2c_probe(struct i2c_client *i2c, | |||
434 | return -ENODEV; | 434 | return -ENODEV; |
435 | } | 435 | } |
436 | 436 | ||
437 | lp3971 = kzalloc(sizeof(struct lp3971), GFP_KERNEL); | 437 | lp3971 = devm_kzalloc(&i2c->dev, sizeof(struct lp3971), GFP_KERNEL); |
438 | if (lp3971 == NULL) | 438 | if (lp3971 == NULL) |
439 | return -ENOMEM; | 439 | return -ENOMEM; |
440 | 440 | ||
@@ -449,19 +449,15 @@ static int lp3971_i2c_probe(struct i2c_client *i2c, | |||
449 | ret = -ENODEV; | 449 | ret = -ENODEV; |
450 | if (ret < 0) { | 450 | if (ret < 0) { |
451 | dev_err(&i2c->dev, "failed to detect device\n"); | 451 | dev_err(&i2c->dev, "failed to detect device\n"); |
452 | goto err_detect; | 452 | return ret; |
453 | } | 453 | } |
454 | 454 | ||
455 | ret = setup_regulators(lp3971, pdata); | 455 | ret = setup_regulators(lp3971, pdata); |
456 | if (ret < 0) | 456 | if (ret < 0) |
457 | goto err_detect; | 457 | return ret; |
458 | 458 | ||
459 | i2c_set_clientdata(i2c, lp3971); | 459 | i2c_set_clientdata(i2c, lp3971); |
460 | return 0; | 460 | return 0; |
461 | |||
462 | err_detect: | ||
463 | kfree(lp3971); | ||
464 | return ret; | ||
465 | } | 461 | } |
466 | 462 | ||
467 | static int lp3971_i2c_remove(struct i2c_client *i2c) | 463 | static int lp3971_i2c_remove(struct i2c_client *i2c) |
@@ -473,7 +469,6 @@ static int lp3971_i2c_remove(struct i2c_client *i2c) | |||
473 | regulator_unregister(lp3971->rdev[i]); | 469 | regulator_unregister(lp3971->rdev[i]); |
474 | 470 | ||
475 | kfree(lp3971->rdev); | 471 | kfree(lp3971->rdev); |
476 | kfree(lp3971); | ||
477 | 472 | ||
478 | return 0; | 473 | return 0; |
479 | } | 474 | } |
diff --git a/drivers/regulator/lp3972.c b/drivers/regulator/lp3972.c index 61e4cf9edf6e..573024039ca0 100644 --- a/drivers/regulator/lp3972.c +++ b/drivers/regulator/lp3972.c | |||
@@ -528,7 +528,7 @@ static int lp3972_i2c_probe(struct i2c_client *i2c, | |||
528 | return -ENODEV; | 528 | return -ENODEV; |
529 | } | 529 | } |
530 | 530 | ||
531 | lp3972 = kzalloc(sizeof(struct lp3972), GFP_KERNEL); | 531 | lp3972 = devm_kzalloc(&i2c->dev, sizeof(struct lp3972), GFP_KERNEL); |
532 | if (!lp3972) | 532 | if (!lp3972) |
533 | return -ENOMEM; | 533 | return -ENOMEM; |
534 | 534 | ||
@@ -546,19 +546,15 @@ static int lp3972_i2c_probe(struct i2c_client *i2c, | |||
546 | } | 546 | } |
547 | if (ret < 0) { | 547 | if (ret < 0) { |
548 | dev_err(&i2c->dev, "failed to detect device. ret = %d\n", ret); | 548 | dev_err(&i2c->dev, "failed to detect device. ret = %d\n", ret); |
549 | goto err_detect; | 549 | return ret; |
550 | } | 550 | } |
551 | 551 | ||
552 | ret = setup_regulators(lp3972, pdata); | 552 | ret = setup_regulators(lp3972, pdata); |
553 | if (ret < 0) | 553 | if (ret < 0) |
554 | goto err_detect; | 554 | return ret; |
555 | 555 | ||
556 | i2c_set_clientdata(i2c, lp3972); | 556 | i2c_set_clientdata(i2c, lp3972); |
557 | return 0; | 557 | return 0; |
558 | |||
559 | err_detect: | ||
560 | kfree(lp3972); | ||
561 | return ret; | ||
562 | } | 558 | } |
563 | 559 | ||
564 | static int lp3972_i2c_remove(struct i2c_client *i2c) | 560 | static int lp3972_i2c_remove(struct i2c_client *i2c) |
@@ -569,7 +565,6 @@ static int lp3972_i2c_remove(struct i2c_client *i2c) | |||
569 | for (i = 0; i < lp3972->num_regulators; i++) | 565 | for (i = 0; i < lp3972->num_regulators; i++) |
570 | regulator_unregister(lp3972->rdev[i]); | 566 | regulator_unregister(lp3972->rdev[i]); |
571 | kfree(lp3972->rdev); | 567 | kfree(lp3972->rdev); |
572 | kfree(lp3972); | ||
573 | 568 | ||
574 | return 0; | 569 | return 0; |
575 | } | 570 | } |