Message ID | 1357448005-20896-1-git-send-email-devendra.aaru@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Sat, Jan 05, 2013 at 11:53:25PM -0500, Devendra Naga wrote: > use devm_kzalloc and no need of error path and unload frees > > Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> > --- Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c index 22cfe9c..74a0bd9 100644 --- a/drivers/power/max17040_battery.c +++ b/drivers/power/max17040_battery.c @@ -207,7 +207,7 @@ static int max17040_probe(struct i2c_client *client, if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) return -EIO; - chip = kzalloc(sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); if (!chip) return -ENOMEM; @@ -225,7 +225,6 @@ static int max17040_probe(struct i2c_client *client, ret = power_supply_register(&client->dev, &chip->battery); if (ret) { dev_err(&client->dev, "failed: power supply register\n"); - kfree(chip); return ret; } @@ -244,7 +243,6 @@ static int max17040_remove(struct i2c_client *client) power_supply_unregister(&chip->battery); cancel_delayed_work(&chip->work); - kfree(chip); return 0; }
use devm_kzalloc and no need of error path and unload frees Signed-off-by: Devendra Naga <devendra.aaru@gmail.com> --- drivers/power/max17040_battery.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)