{
struct lp8727_psy *psy;
- psy = kzalloc(sizeof(*psy), GFP_KERNEL);
+ psy = devm_kzalloc(pchg->dev, sizeof(*psy), GFP_KERNEL);
if (!psy)
return -ENOMEM;
err_psy_usb:
power_supply_unregister(&psy->ac);
err_psy_ac:
- kfree(psy);
return -EPERM;
}
power_supply_unregister(&psy->ac);
power_supply_unregister(&psy->usb);
power_supply_unregister(&psy->batt);
- kfree(psy);
}
static int lp8727_probe(struct i2c_client *cl, const struct i2c_device_id *id)
if (!i2c_check_functionality(cl->adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
return -EIO;
- pchg = kzalloc(sizeof(*pchg), GFP_KERNEL);
+ pchg = devm_kzalloc(&cl->dev, sizeof(*pchg), GFP_KERNEL);
if (!pchg)
return -ENOMEM;
return 0;
error:
- kfree(pchg);
return ret;
}
free_irq(pchg->client->irq, pchg);
flush_workqueue(pchg->irqthread);
destroy_workqueue(pchg->irqthread);
- kfree(pchg);
return 0;
}