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

Commit b4a88a55 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-charger: Fix null pointer dereference error"

parents dffcf6c0 2d41a577
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -4243,10 +4243,12 @@ static void smbchg_chg_led_brightness_set(struct led_classdev *cdev,
	reg = (value > LED_OFF) ? CHG_LED_ON << CHG_LED_SHIFT :
		CHG_LED_OFF << CHG_LED_SHIFT;

	if (chip->bms_psy) {
		if (value > LED_OFF)
			power_supply_set_hi_power_state(chip->bms_psy, 1);
		else
			power_supply_set_hi_power_state(chip->bms_psy, 0);
	}

	pr_smb(PR_STATUS,
			"set the charger led brightness to value=%d\n",
@@ -4289,11 +4291,16 @@ static void smbchg_chg_led_blink_set(struct smbchg_chip *chip,
	u8 reg;
	int rc;

	if (chip->bms_psy) {
		if (blinking == 0)
			power_supply_set_hi_power_state(chip->bms_psy, 0);
		else
			power_supply_set_hi_power_state(chip->bms_psy, 1);
	}

	if (blinking == 0) {
		reg = CHG_LED_OFF << CHG_LED_SHIFT;
		power_supply_set_hi_power_state(chip->bms_psy, 0);
	} else {
		power_supply_set_hi_power_state(chip->bms_psy, 1);
		if (blinking == 1)
			reg = LED_BLINKING_PATTERN2 << CHG_LED_SHIFT;
		else if (blinking == 2)