* [PATCH] mfd: tps6507x: Convert to devm_kzalloc
@ 2012-12-09 12:25 Axel Lin
2012-12-09 15:47 ` Samuel Ortiz
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2012-12-09 12:25 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: Todd Fischer, linux-kernel
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/mfd/tps6507x.c | 21 ++++-----------------
1 file changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/mfd/tps6507x.c b/drivers/mfd/tps6507x.c
index 1b20349..409afa2 100644
--- a/drivers/mfd/tps6507x.c
+++ b/drivers/mfd/tps6507x.c
@@ -86,9 +86,9 @@ static int tps6507x_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct tps6507x_dev *tps6507x;
- int ret = 0;
- tps6507x = kzalloc(sizeof(struct tps6507x_dev), GFP_KERNEL);
+ tps6507x = devm_kzalloc(&i2c->dev, sizeof(struct tps6507x_dev),
+ GFP_KERNEL);
if (tps6507x == NULL)
return -ENOMEM;
@@ -98,19 +98,8 @@ static int tps6507x_i2c_probe(struct i2c_client *i2c,
tps6507x->read_dev = tps6507x_i2c_read_device;
tps6507x->write_dev = tps6507x_i2c_write_device;
- ret = mfd_add_devices(tps6507x->dev, -1,
- tps6507x_devs, ARRAY_SIZE(tps6507x_devs),
- NULL, 0, NULL);
-
- if (ret < 0)
- goto err;
-
- return ret;
-
-err:
- mfd_remove_devices(tps6507x->dev);
- kfree(tps6507x);
- return ret;
+ return mfd_add_devices(tps6507x->dev, -1, tps6507x_devs,
+ ARRAY_SIZE(tps6507x_devs), NULL, 0, NULL);
}
static int tps6507x_i2c_remove(struct i2c_client *i2c)
@@ -118,8 +107,6 @@ static int tps6507x_i2c_remove(struct i2c_client *i2c)
struct tps6507x_dev *tps6507x = i2c_get_clientdata(i2c);
mfd_remove_devices(tps6507x->dev);
- kfree(tps6507x);
-
return 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: tps6507x: Convert to devm_kzalloc
2012-12-09 12:25 [PATCH] mfd: tps6507x: Convert to devm_kzalloc Axel Lin
@ 2012-12-09 15:47 ` Samuel Ortiz
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2012-12-09 15:47 UTC (permalink / raw)
To: Axel Lin; +Cc: Todd Fischer, linux-kernel
Hi Axel,
On Sun, Dec 09, 2012 at 08:25:55PM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/mfd/tps6507x.c | 21 ++++-----------------
> 1 file changed, 4 insertions(+), 17 deletions(-)
Applied, many thanks.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-09 15:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-09 12:25 [PATCH] mfd: tps6507x: Convert to devm_kzalloc Axel Lin
2012-12-09 15:47 ` Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox