aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/ad5398.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-03-26 22:09:42 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-01 06:59:36 -0400
commit0df8c96fa1c1adb23c49124685dde77b6560bef2 (patch)
tree82193e75319334a669ce38bc05a2199aff16b866 /drivers/regulator/ad5398.c
parent935c14a216c1afa855678e200607e98cc8cc2c51 (diff)
regulator: ad5398: Use devm_kzalloc
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/ad5398.c')
-rw-r--r--drivers/regulator/ad5398.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c
index ed587987f445..7d51793a072a 100644
--- a/drivers/regulator/ad5398.c
+++ b/drivers/regulator/ad5398.c
@@ -220,7 +220,7 @@ static int __devinit ad5398_probe(struct i2c_client *client,
220 if (!init_data) 220 if (!init_data)
221 return -EINVAL; 221 return -EINVAL;
222 222
223 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 223 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
224 if (!chip) 224 if (!chip)
225 return -ENOMEM; 225 return -ENOMEM;
226 226
@@ -246,7 +246,6 @@ static int __devinit ad5398_probe(struct i2c_client *client,
246 return 0; 246 return 0;
247 247
248err: 248err:
249 kfree(chip);
250 return ret; 249 return ret;
251} 250}
252 251
@@ -255,8 +254,6 @@ static int __devexit ad5398_remove(struct i2c_client *client)
255 struct ad5398_chip_info *chip = i2c_get_clientdata(client); 254 struct ad5398_chip_info *chip = i2c_get_clientdata(client);
256 255
257 regulator_unregister(chip->rdev); 256 regulator_unregister(chip->rdev);
258 kfree(chip);
259
260 return 0; 257 return 0;
261} 258}
262 259