From 318cb389d020e3107979d7d794ab992e4bcd6665 Mon Sep 17 00:00:00 2001 From: Kim, Milo Date: Fri, 31 Aug 2012 09:23:12 +0000 Subject: lp8727_charger: Fix buggy code of NULL pdata LP8727 platform data is optional, so the driver should work even the platform data is NULL. To check the platform data, charging parameter data should be changed to the pointer type. Fix NULL point access problem when getting the battery properties. When the data is NULL, just return as invalid value. Signed-off-by: Milo(Woogyom) Kim Signed-off-by: Anton Vorontsov --- include/linux/platform_data/lp8727.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/linux/platform_data/lp8727.h') diff --git a/include/linux/platform_data/lp8727.h b/include/linux/platform_data/lp8727.h index ea98c6133d32..f4bcdd5f20a4 100644 --- a/include/linux/platform_data/lp8727.h +++ b/include/linux/platform_data/lp8727.h @@ -51,15 +51,16 @@ struct lp8727_chg_param { * @get_batt_level : get battery voltage (mV) * @get_batt_capacity : get battery capacity (%) * @get_batt_temp : get battery temperature - * @ac, @usb : charging parameters each charger type + * @ac : charging parameters for AC type charger + * @usb : charging parameters for USB type charger */ struct lp8727_platform_data { u8 (*get_batt_present)(void); u16 (*get_batt_level)(void); u8 (*get_batt_capacity)(void); u8 (*get_batt_temp)(void); - struct lp8727_chg_param ac; - struct lp8727_chg_param usb; + struct lp8727_chg_param *ac; + struct lp8727_chg_param *usb; }; #endif -- cgit v1.2.3