if (rk818->rdev[i])
regulator_unregister(rk818->rdev[i]);
i2c_set_clientdata(i2c, NULL);
- kfree(rk818);
return 0;
}
static int bq24296_battery_remove(struct i2c_client *client)
{
- struct bq24296_device_info *di = i2c_get_clientdata(client);
- kfree(di);
+
return 0;
}
bq27320_powersupply_init(di);
retval = power_supply_register(&client->dev, &di->bat);
- if (retval) {
+ if (retval)
dev_err(&client->dev, "failed to register battery\n");
- goto batt_failed_4;
- }
-
+
retval = power_supply_register(&client->dev, &di->usb);
- if (retval) {
+ if (retval)
dev_err(&client->dev, "failed to register ac\n");
- goto batt_failed_4;
- }
retval = power_supply_register(&client->dev, &di->ac);
- if (retval) {
+ if (retval)
dev_err(&client->dev, "failed to register ac\n");
- goto batt_failed_4;
- }
g_bq27320_i2c_client = client;
return 0;
-batt_failed_4:
- kfree(di);
batt_failed_3:
driver_remove_file(&(bq27320_battery_driver.driver), &driver_attr_state);
batt_failed_2:
kfree(di->bat.name);
kfree(di->usb.name);
kfree(di->ac.name);
- kfree(di);
return 0;
}
return 0;
out:
- kfree(info);
return ret;
}
#endif
power_supply_unregister(&info->battery);
- kfree(info);
platform_set_drvdata(pdev, NULL);
return 0;
}
gSecondsCnt = get_seconds();
/*data = kzalloc(sizeof(*data), GFP_KERNEL);*/
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
- if (data == NULL) {
+ if (data == NULL)
ret = -ENOMEM;
- goto err_data_alloc_failed;
- }
/*pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);*/
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
- if (pdata == NULL) {
+ if (pdata == NULL)
ret = -ENOMEM;
- goto err_pdata_alloc_failed;
- }
+
memset(data, 0, sizeof(struct rk30_adc_battery_data));
gBatteryData = data;
platform_set_drvdata(pdev, data);
#endif
err_io_init:
-
-err_pdata_alloc_failed:
- kfree(pdata);
-err_data_alloc_failed:
- kfree(data);
-
printk("rk30_adc_battery: error!\n");
return ret;
power_supply_unregister(&data ->bat);
if (batt_gpio_is_valid(pdata->dc_det_pin))
free_irq(gpio_to_irq(pdata->dc_det_pin), data);
-
- kfree(data);
return 0;
}
power_supply_unregister(&bi->battery);
cancel_delayed_work(&bi->monitor_work);
wake_lock_destroy(&bi->monitor_wake_lock);
- kfree(bi);
RTINFO("\n");
return 0;
}
if (pdev) {
act8846->num_regulators = act8846_NUM_REGULATORS;
- act8846->rdev = kcalloc(act8846_NUM_REGULATORS,sizeof(struct regulator_dev *), GFP_KERNEL);
+ act8846->rdev = devm_kcalloc(act8846->dev,
+ act8846_NUM_REGULATORS,
+ sizeof(struct regulator_dev *),
+ GFP_KERNEL);
if (!act8846->rdev) {
return -ENOMEM;
}
for (i = 0; i < act8846->num_regulators; i++)
if (act8846->rdev[i])
regulator_unregister(act8846->rdev[i]);
- kfree(act8846->rdev);
i2c_set_clientdata(i2c, NULL);
- kfree(act8846);
return 0;
}
if (pdata) {
act8931->num_regulators = ACT8931_NUM_REGULATORS;
- act8931->rdev = kcalloc(ACT8931_NUM_REGULATORS,
- sizeof(struct regulator_dev *),
- GFP_KERNEL);
+ act8931->rdev = devm_kcalloc(act8931->dev,
+ ACT8931_NUM_REGULATORS,
+ sizeof(struct regulator_dev *),
+ GFP_KERNEL);
if (!act8931->rdev)
return -ENOMEM;
for (i = 0; i < act8931->num_regulators; i++)
if (act8931->rdev[i])
regulator_unregister(act8931->rdev[i]);
- kfree(act8931->rdev);
i2c_set_clientdata(i2c, NULL);
- kfree(act8931);
return 0;
}
device_init_wakeup(&pdev->dev, 1);
// printk(KERN_INFO "PMU: %s register rtc device \n", __func__);
- rtc->rtc = rtc_device_register(pdev->name, &pdev->dev,
+ rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
&ricoh619_rtc_ops, THIS_MODULE);
// set interrupt and enable it
return 0;
fail:
- if (!IS_ERR_OR_NULL(rtc->rtc))
- rtc_device_unregister(rtc->rtc);
- kfree(rtc);
return err;
}
static int ricoh619_rtc_remove(struct platform_device *pdev)
{
- struct ricoh619_rtc *rtc = dev_get_drvdata(&pdev->dev);
-
- rtc_device_unregister(rtc->rtc);
- kfree(rtc);
return 0;
}