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

Commit 2cf48716 authored by Sarangdhar Joshi's avatar Sarangdhar Joshi
Browse files

soc: qcom: jtagv8-etm: validate driver data before using



msm_jtag_etm_save_state() and msm_jtag_etm_restore_state() are
called from hotcpu callback notifiers. These notifiers can get
called before jtagv8-etm driver data is initialized in probe()
function. Add NULL pointer check to make sure driver data is
initialized before using it.

Change-Id: Ieb17708a6d07d3928d56da08b275633f003d9ed0
Signed-off-by: default avatarSarangdhar Joshi <spjoshi@codeaurora.org>
parent 7af2265a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1414,10 +1414,10 @@ void msm_jtag_etm_save_state(void)

	cpu = raw_smp_processor_id();

	if (etm[cpu]->save_restore_disabled)
	if (!etm[cpu] || etm[cpu]->save_restore_disabled)
		return;

	if (etm[cpu] && etm[cpu]->save_restore_enabled) {
	if (etm[cpu]->save_restore_enabled) {
		if (etm[cpu]->si_enable)
			etm_si_save_state(etm[cpu]);
		else
@@ -1432,14 +1432,14 @@ void msm_jtag_etm_restore_state(void)

	cpu = raw_smp_processor_id();

	if (etm[cpu]->save_restore_disabled)
	if (!etm[cpu] || etm[cpu]->save_restore_disabled)
		return;

	/*
	 * Check to ensure we attempt to restore only when save
	 * has been done is accomplished by callee function.
	 */
	if (etm[cpu] && etm[cpu]->save_restore_enabled) {
	if (etm[cpu]->save_restore_enabled) {
		if (etm[cpu]->si_enable)
			etm_si_restore_state(etm[cpu]);
		else