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

Commit 83b04401 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: battery: fix usage of un-initialized variable in FCC stepper"

parents d792e1d2 dabaa774
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -561,23 +561,21 @@ static void get_main_fcc_config(struct pl_data *chip, int *total_fcc)
static void get_fcc_stepper_params(struct pl_data *chip, int main_fcc_ua,
			int parallel_fcc_ua)
{
	union power_supply_propval pval = {0, };

	/* Read current FCC of main charger */
	chip->main_fcc_ua = get_effective_result(chip->fcc_main_votable);
	chip->main_step_fcc_dir = (main_fcc_ua > pval.intval) ?
	chip->main_step_fcc_dir = (main_fcc_ua > chip->main_fcc_ua) ?
				STEP_UP : STEP_DOWN;
	chip->main_step_fcc_count = abs((main_fcc_ua - pval.intval) /
	chip->main_step_fcc_count = abs((main_fcc_ua - chip->main_fcc_ua) /
				FCC_STEP_SIZE_UA);
	chip->main_step_fcc_residual = abs((main_fcc_ua - chip->main_fcc_ua) %
				FCC_STEP_SIZE_UA);
	chip->main_step_fcc_residual = (main_fcc_ua - pval.intval) %
				FCC_STEP_SIZE_UA;

	chip->parallel_step_fcc_dir = (parallel_fcc_ua > chip->slave_fcc_ua) ?
				STEP_UP : STEP_DOWN;
	chip->parallel_step_fcc_count = abs((parallel_fcc_ua -
				chip->slave_fcc_ua) / FCC_STEP_SIZE_UA);
	chip->parallel_step_fcc_residual = (parallel_fcc_ua -
				chip->slave_fcc_ua) % FCC_STEP_SIZE_UA;
	chip->parallel_step_fcc_residual = abs((parallel_fcc_ua -
				chip->slave_fcc_ua)) % FCC_STEP_SIZE_UA;

	if (chip->parallel_step_fcc_count || chip->parallel_step_fcc_residual
		|| chip->main_step_fcc_count || chip->main_step_fcc_residual)