lkml.org 
[lkml]   [2012]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2/2] regulator: ad5398: Use devm_kzalloc
From
Date
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/ad5398.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c
index ed58798..7d51793 100644
--- a/drivers/regulator/ad5398.c
+++ b/drivers/regulator/ad5398.c
@@ -220,7 +220,7 @@ static int __devinit ad5398_probe(struct i2c_client *client,
if (!init_data)
return -EINVAL;

- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
+ chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;

@@ -246,7 +246,6 @@ static int __devinit ad5398_probe(struct i2c_client *client,
return 0;

err:
- kfree(chip);
return ret;
}

@@ -255,8 +254,6 @@ static int __devexit ad5398_remove(struct i2c_client *client)
struct ad5398_chip_info *chip = i2c_get_clientdata(client);

regulator_unregister(chip->rdev);
- kfree(chip);
-
return 0;
}

--
1.7.5.4




\
 
 \ /
  Last update: 2012-03-27 04:11    [W:0.049 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site