diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 12:10:15 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-31 12:10:15 -0700 |
commit | 76f901eb4659779ecacd0e4eba49f55442daef53 (patch) | |
tree | 0761f03211ffdfc06216eabeb61b02ef6d598d3c /drivers/power/ab8500_charger.c | |
parent | bd0e162d0312aa95e8b85ba883efddebf27be121 (diff) | |
parent | 96facd23e45e6d5020be135c8ab392ba9e044fa4 (diff) | |
download | linux-76f901eb4659779ecacd0e4eba49f55442daef53.tar.bz2 |
Merge tag 'for-v3.5' of git://git.infradead.org/battery-2.6
Pull battery updates from Anton Vorontsov:
"A bunch of fixes for v3.5, nothing extraordinary."
* tag 'for-v3.5' of git://git.infradead.org/battery-2.6: (27 commits)
smb347-charger: Include missing <linux/err.h>
smb347-charger: Clean up battery attributes
max17042_battery: Add support for max17047/50 chip
sbs-battery.c: Capacity attr = remaining relative capacity
isp1704_charger: Use after free on probe error
ds2781_battery: Use DS2781_PARAM_EEPROM_SIZE and DS2781_USER_EEPROM_SIZE
power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry
charger-manager: Provide cm_notify_event function for in-kernel use
charger-manager: Poll battery health in normal state
smb347-charger: Convert to regmap API
smb347-charger: Move IRQ enabling to the end of probe
smb347-charger: Rename few functions to match better what they are doing
smb347-charger: Convert to use module_i2c_driver()
smb347_charger: Cleanup power supply registration code in probe
ab8500: Clean up probe routines
ab8500_fg: Harden platform data check
ab8500_btemp: Harden platform data check
ab8500_charger: Harden platform data check
MAINTAINERS: Fix 'F' entry for the power supply class
max17042_battery: Handle irq request failure case
...
Diffstat (limited to 'drivers/power/ab8500_charger.c')
-rw-r--r-- | drivers/power/ab8500_charger.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c index e2b4accbec88..d2303d0b7c75 100644 --- a/drivers/power/ab8500_charger.c +++ b/drivers/power/ab8500_charger.c @@ -2534,10 +2534,15 @@ static int __devexit ab8500_charger_remove(struct platform_device *pdev) static int __devinit ab8500_charger_probe(struct platform_device *pdev) { int irq, i, charger_status, ret = 0; - struct abx500_bm_plat_data *plat_data; + struct abx500_bm_plat_data *plat_data = pdev->dev.platform_data; + struct ab8500_charger *di; - struct ab8500_charger *di = - kzalloc(sizeof(struct ab8500_charger), GFP_KERNEL); + if (!plat_data) { + dev_err(&pdev->dev, "No platform data\n"); + return -EINVAL; + } + + di = kzalloc(sizeof(*di), GFP_KERNEL); if (!di) return -ENOMEM; @@ -2550,9 +2555,7 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev) spin_lock_init(&di->usb_state.usb_lock); /* get charger specific platform data */ - plat_data = pdev->dev.platform_data; di->pdata = plat_data->charger; - if (!di->pdata) { dev_err(di->dev, "no charger platform data supplied\n"); ret = -EINVAL; |