Skip to content

Commit

Permalink
regulator: isl6271a-regulator: Use devm_kzalloc()
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Axel Lin authored and Mark Brown committed Apr 13, 2012
1 parent 276909d commit ef6bd5a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/regulator/isl6271a-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c,
if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO;

pmic = kzalloc(sizeof(struct isl_pmic), GFP_KERNEL);
pmic = devm_kzalloc(&i2c->dev, sizeof(struct isl_pmic), GFP_KERNEL);
if (!pmic)
return -ENOMEM;

Expand Down Expand Up @@ -179,8 +179,6 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c,
error:
while (--i >= 0)
regulator_unregister(pmic->rdev[i]);

kfree(pmic);
return err;
}

Expand All @@ -191,9 +189,6 @@ static int __devexit isl6271a_remove(struct i2c_client *i2c)

for (i = 0; i < 3; i++)
regulator_unregister(pmic->rdev[i]);

kfree(pmic);

return 0;
}

Expand Down

0 comments on commit ef6bd5a

Please sign in to comment.