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

Commit cc1a8086 authored by Anirudh Ghayal's avatar Anirudh Ghayal Committed by Gerrit - the friendly Code Review server
Browse files

power: smb5-lib: Cancel alarm_timer conditionally



Cancel the alarm timer and work only if the charger
termination workaround is enabled to avoid
a NULL pointer exception.

Change-Id: I573239db0f373d9188fc379653cedd305d2a552c
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent 8f765160
Loading
Loading
Loading
Loading
+10 −4
Original line number Original line Diff line number Diff line
@@ -1085,6 +1085,8 @@ static void smblib_uusb_removal(struct smb_charger *chg)
					false);
					false);


	cancel_delayed_work_sync(&chg->pl_enable_work);
	cancel_delayed_work_sync(&chg->pl_enable_work);

	if (chg->wa_flags & CHG_TERMINATION_WA)
		alarm_cancel(&chg->chg_termination_alarm);
		alarm_cancel(&chg->chg_termination_alarm);


	if (chg->wa_flags & BOOST_BACK_WA) {
	if (chg->wa_flags & BOOST_BACK_WA) {
@@ -5020,6 +5022,8 @@ static void typec_src_removal(struct smb_charger *chg)
	}
	}


	cancel_delayed_work_sync(&chg->pl_enable_work);
	cancel_delayed_work_sync(&chg->pl_enable_work);

	if (chg->wa_flags & CHG_TERMINATION_WA)
		alarm_cancel(&chg->chg_termination_alarm);
		alarm_cancel(&chg->chg_termination_alarm);


	/* reset input current limit voters */
	/* reset input current limit voters */
@@ -6455,11 +6459,13 @@ int smblib_deinit(struct smb_charger *chg)
			alarm_cancel(&chg->moisture_protection_alarm);
			alarm_cancel(&chg->moisture_protection_alarm);
			cancel_work_sync(&chg->moisture_protection_work);
			cancel_work_sync(&chg->moisture_protection_work);
		}
		}
		if (chg->wa_flags & CHG_TERMINATION_WA) {
			alarm_cancel(&chg->chg_termination_alarm);
			alarm_cancel(&chg->chg_termination_alarm);
			cancel_work_sync(&chg->chg_termination_work);
		}
		cancel_work_sync(&chg->bms_update_work);
		cancel_work_sync(&chg->bms_update_work);
		cancel_work_sync(&chg->jeita_update_work);
		cancel_work_sync(&chg->jeita_update_work);
		cancel_work_sync(&chg->pl_update_work);
		cancel_work_sync(&chg->pl_update_work);
		cancel_work_sync(&chg->chg_termination_work);
		cancel_delayed_work_sync(&chg->clear_hdc_work);
		cancel_delayed_work_sync(&chg->clear_hdc_work);
		cancel_delayed_work_sync(&chg->icl_change_work);
		cancel_delayed_work_sync(&chg->icl_change_work);
		cancel_delayed_work_sync(&chg->pl_enable_work);
		cancel_delayed_work_sync(&chg->pl_enable_work);