History

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.

Kim, Milo committed 14 years ago

Commit 318cb381 parent fb9adc52 files · +25 −10Browse files

Showing the changes to include/linux/platform_data (1 of 2 files). Show all

Unified · Split

include/linux/platform_data/lp8727.h+4−3
@@ -51,15 +51,16 @@ struct lp8727_chg_param { · 50 unmodified lines
5151 * @get_batt_level : get battery voltage (mV)
5252 * @get_batt_capacity : get battery capacity (%)
5353 * @get_batt_temp : get battery temperature
54− * @ac, @usb : charging parameters each charger type
54+ * @ac : charging parameters for AC type charger
55+ * @usb : charging parameters for USB type charger
5556 */
5657 struct lp8727_platform_data {
5758 u8 (*get_batt_present)(void);
5859 u16 (*get_batt_level)(void);
5960 u8 (*get_batt_capacity)(void);
6061 u8 (*get_batt_temp)(void);
61− struct lp8727_chg_param ac;
62− struct lp8727_chg_param usb;
62+ struct lp8727_chg_param *ac;
63+ struct lp8727_chg_param *usb;
6364 };
6465
6566 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t