Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbc5cada authored by Shantanu Jain's avatar Shantanu Jain Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarShantanu Jain <shjain@codeaurora.org>
parent dd0af8d2
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -1409,6 +1409,7 @@ static void qpnp_flash_led_work(struct work_struct *work)
			max_curr_avail_ma += flash_node->max_current;

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

		if (led->pdata->power_detect_en ||
					led->pdata->die_current_derate_en) {