Commit 0df8c96f authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: ad5398: Use devm_kzalloc

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarSonic Zhang <sonic.zhang@analog.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 935c14a2
...@@ -220,7 +220,7 @@ static int __devinit ad5398_probe(struct i2c_client *client, ...@@ -220,7 +220,7 @@ static int __devinit ad5398_probe(struct i2c_client *client,
if (!init_data) if (!init_data)
return -EINVAL; return -EINVAL;
chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip) if (!chip)
return -ENOMEM; return -ENOMEM;
...@@ -246,7 +246,6 @@ static int __devinit ad5398_probe(struct i2c_client *client, ...@@ -246,7 +246,6 @@ static int __devinit ad5398_probe(struct i2c_client *client,
return 0; return 0;
err: err:
kfree(chip);
return ret; return ret;
} }
...@@ -255,8 +254,6 @@ static int __devexit ad5398_remove(struct i2c_client *client) ...@@ -255,8 +254,6 @@ static int __devexit ad5398_remove(struct i2c_client *client)
struct ad5398_chip_info *chip = i2c_get_clientdata(client); struct ad5398_chip_info *chip = i2c_get_clientdata(client);
regulator_unregister(chip->rdev); regulator_unregister(chip->rdev);
kfree(chip);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment