aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/max17040_battery.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/power/max17040_battery.c')
-rw-r--r--drivers/power/max17040_battery.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c
index c7ff6d67f158..0fbac861080d 100644
--- a/drivers/power/max17040_battery.c
+++ b/drivers/power/max17040_battery.c
@@ -148,7 +148,7 @@ static void max17040_get_online(struct i2c_client *client)
148{ 148{
149 struct max17040_chip *chip = i2c_get_clientdata(client); 149 struct max17040_chip *chip = i2c_get_clientdata(client);
150 150
151 if (chip->pdata->battery_online) 151 if (chip->pdata && chip->pdata->battery_online)
152 chip->online = chip->pdata->battery_online(); 152 chip->online = chip->pdata->battery_online();
153 else 153 else
154 chip->online = 1; 154 chip->online = 1;
@@ -158,7 +158,8 @@ static void max17040_get_status(struct i2c_client *client)
158{ 158{
159 struct max17040_chip *chip = i2c_get_clientdata(client); 159 struct max17040_chip *chip = i2c_get_clientdata(client);
160 160
161 if (!chip->pdata->charger_online || !chip->pdata->charger_enable) { 161 if (!chip->pdata || !chip->pdata->charger_online
162 || !chip->pdata->charger_enable) {
162 chip->status = POWER_SUPPLY_STATUS_UNKNOWN; 163 chip->status = POWER_SUPPLY_STATUS_UNKNOWN;
163 return; 164 return;
164 } 165 }