aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/tps6586x.c
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-07-18 02:20:45 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-07-24 18:36:53 -0400
commitb6719412dc28458f3c142a27bf3e0d2ab3ce0573 (patch)
tree877edd66855d972926cd9b761c4937c53e741528 /drivers/mfd/tps6586x.c
parent96c905f408d4ed16b7b87d7d2b16e8d8d02f0cc8 (diff)
mfd: Use devm managed resources for tps6586x
Allocate memory for device state using devm_kzalloc() to simplify accounting and letting the kernel do the garbage-collection. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/tps6586x.c')
-rw-r--r--drivers/mfd/tps6586x.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index c84b5506d5fb..c103ea903614 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -579,9 +579,11 @@ static int __devinit tps6586x_i2c_probe(struct i2c_client *client,
579 579
580 dev_info(&client->dev, "VERSIONCRC is %02x\n", ret); 580 dev_info(&client->dev, "VERSIONCRC is %02x\n", ret);
581 581
582 tps6586x = kzalloc(sizeof(struct tps6586x), GFP_KERNEL); 582 tps6586x = devm_kzalloc(&client->dev, sizeof(*tps6586x), GFP_KERNEL);
583 if (tps6586x == NULL) 583 if (tps6586x == NULL) {
584 dev_err(&client->dev, "memory for tps6586x alloc failed\n");
584 return -ENOMEM; 585 return -ENOMEM;
586 }
585 587
586 tps6586x->client = client; 588 tps6586x->client = client;
587 tps6586x->dev = &client->dev; 589 tps6586x->dev = &client->dev;
@@ -594,7 +596,7 @@ static int __devinit tps6586x_i2c_probe(struct i2c_client *client,
594 pdata->irq_base); 596 pdata->irq_base);
595 if (ret) { 597 if (ret) {
596 dev_err(&client->dev, "IRQ init failed: %d\n", ret); 598 dev_err(&client->dev, "IRQ init failed: %d\n", ret);
597 goto err_irq_init; 599 return ret;
598 } 600 }
599 } 601 }
600 602
@@ -622,8 +624,7 @@ err_add_devs:
622err_gpio_init: 624err_gpio_init:
623 if (client->irq) 625 if (client->irq)
624 free_irq(client->irq, tps6586x); 626 free_irq(client->irq, tps6586x);
625err_irq_init: 627
626 kfree(tps6586x);
627 return ret; 628 return ret;
628} 629}
629 630
@@ -644,7 +645,6 @@ static int __devexit tps6586x_i2c_remove(struct i2c_client *client)
644 } 645 }
645 646
646 tps6586x_remove_subdevs(tps6586x); 647 tps6586x_remove_subdevs(tps6586x);
647 kfree(tps6586x);
648 return 0; 648 return 0;
649} 649}
650 650