From: Axel Lin Date: Tue, 27 Mar 2012 02:09:42 +0000 (+0800) Subject: regulator: ad5398: Use devm_kzalloc X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=0df8c96fa1c1adb23c49124685dde77b6560bef2;p=deliverable%2Flinux.git regulator: ad5398: Use devm_kzalloc Signed-off-by: Axel Lin Acked-by: Sonic Zhang Signed-off-by: Mark Brown --- 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, 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; }