leds: qpnp-flash: check power supply variable in flash led driver

Check the power supply variable if it is NULL or not, in flash led
driver while enabling the flash led.
This change is added to avoid crash in flash led driver.

CRs-Fixed: 944997
Change-Id: Ide1a9151d2a7c9a6686268a53ec9e38a4b087808
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
This commit is contained in:
Shantanu Jain 2016-02-23 13:11:20 +05:30 committed by Gerrit - the friendly Code Review server
parent e548e8dd63
commit d9f7c94052
1 changed files with 10 additions and 4 deletions

View File

@ -1242,12 +1242,18 @@ static void qpnp_flash_led_work(struct work_struct *work)
max_curr_avail_ma += flash_node->max_current;
psy_prop.intval = true;
rc = led->battery_psy->set_property(led->battery_psy,
if (led->battery_psy) {
rc = led->battery_psy->set_property(led->battery_psy,
POWER_SUPPLY_PROP_FLASH_ACTIVE,
&psy_prop);
if (rc) {
&psy_prop);
if (rc) {
dev_err(&led->spmi_dev->dev,
"Failed to setup OTG pulse skip enable\n");
goto exit_flash_led_work;
}
} else {
dev_err(&led->spmi_dev->dev,
"Failed to setup OTG pulse skip enable\n");
"led->battery_psy is NULL\n");
goto exit_flash_led_work;
}