diff options
author | Abhishek Aggarwal <aaggarwal@nvidia.com> | 2010-08-06 12:57:15 +0530 |
---|---|---|
committer | Yu-Huan Hsu <yhsu@nvidia.com> | 2010-08-09 20:05:35 -0700 |
commit | bd02041a4edceef0baf2d0904c082b8174c898c2 (patch) | |
tree | 32227b4f915ebb3988cc966b7613ff9be6bc10ac | |
parent | 98d4ea4724a713a8f612fe42bdfd65b0f2a3adcd (diff) |
[arm tegra] power: proper error handling in battery probe
If the open of tegra odm battery driver fails, we are failing the probe
of tegra-battery without unregistering the tegra power supplies which
causes errors during boot.
Fixed this by moving the call to open tegra odm battery driver and its
failure check before we register tegra power supplies.
Bug 715515
Change-Id: Ie11c860fa692b3b707ce79796e2713366107bdec
Reviewed-on: http://git-master/r/4839
Tested-by: Abhishek Aggarwal <aaggarwal@nvidia.com>
Reviewed-by: Hanumanth Venkateswa Moganty <vmoganty@nvidia.com>
Reviewed-by: Phillip Smith <psmith@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
-rw-r--r-- | drivers/power/tegra_odm_battery.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/power/tegra_odm_battery.c b/drivers/power/tegra_odm_battery.c index d0c61978ae9b..5904d372c9f1 100644 --- a/drivers/power/tegra_odm_battery.c +++ b/drivers/power/tegra_odm_battery.c @@ -397,6 +397,12 @@ static int tegra_battery_probe(struct platform_device *pdev) batt_dev->charging_source = NvCharger_Type_AC; batt_dev->charging_enabled = NvCharge_Control_Charging_Enable; + result = NvOdmBatteryDeviceOpen(&(batt_dev->hOdmBattDev), NULL); + if (!result) { + pr_err("NvOdmBatteryDeviceOpen FAILED\n"); + goto err; + } + for (i = 0; i < ARRAY_SIZE(tegra_supplies); i++) { rc = power_supply_register(&pdev->dev, &tegra_supplies[i]); if (rc) { @@ -408,11 +414,7 @@ static int tegra_battery_probe(struct platform_device *pdev) } } printk(KERN_INFO "%s: battery driver registered\n", pdev->name); - result = NvOdmBatteryDeviceOpen(&(batt_dev->hOdmBattDev), NULL); - if (!result) { - pr_err("NvOdmBatteryDeviceOpen FAILED\n"); - goto err; - } + batt_dev->batt_status_poll_period = NVBATTERY_POLLING_INTERVAL; setup_timer(&(batt_dev->battery_poll_timer), tegra_battery_poll_timer_func, 0); mod_timer(&(batt_dev->battery_poll_timer), |