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

Commit 12502eea authored by Xiaozhe Shi's avatar Xiaozhe Shi
Browse files

power: qpnp-smbcharger: fix hardware initialization sequence



Currently, in the function smbchg_hw_init, the return value of the call
to smbchg_set_thermal_limited_dc_current_max is always returned. This is
incorrect and will cause the rest of the hw_init function to never run.

Fix this by checking the return code and only returning if it's
non-zero.

Change-Id: I9de4862c3c54fa9a9183245b3bf53564c3f635d0
Signed-off-by: default avatarXiaozhe Shi <xiaozhes@codeaurora.org>
parent d5fc7ff6
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -2241,9 +2241,15 @@ static int smbchg_hw_init(struct smbchg_chip *chip)
	}

	/* DC path current settings */
	if (chip->dc_psy_type != -EINVAL)
		return smbchg_set_thermal_limited_dc_current_max(chip,
	if (chip->dc_psy_type != -EINVAL) {
		rc = smbchg_set_thermal_limited_dc_current_max(chip,
						chip->dc_target_current_ma);
		if (rc < 0) {
			dev_err(chip->dev, "can't set dc current: %d\n", rc);
			return rc;
		}
	}


	/*
	 * on some devices the battery is powered via external sources which
@@ -2253,7 +2259,7 @@ static int smbchg_hw_init(struct smbchg_chip *chip)
	 * hot/cold when powered via external source).
	 */
	if (chip->soft_vfloat_comp_disabled) {
		rc |= smbchg_sec_masked_write(chip, chip->chgr_base + CFG_AFVC,
		rc = smbchg_sec_masked_write(chip, chip->chgr_base + CFG_AFVC,
				VFLOAT_COMP_ENABLE_MASK, 0);
		if (rc < 0) {
			dev_err(chip->dev, "Couldn't disable soft vfloat rc = %d\n",