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

Commit 0fc7290b authored by Skylar Chang's avatar Skylar Chang Committed by Gerrit - the friendly Code Review server
Browse files

msm: gsi: use reinit_completion



To avoid a race condition between init_completion() and complete()
which will cause a crash use reinit_completion() which is safe.

CRs-Fixed: 1114785
Change-Id: I5b5c9eb6a4dbe406951d71fe5963b3c4e411daa0
Acked-by: default avatarAdy Abraham <adya@qti.qualcomm.com>
Signed-off-by: default avatarSkylar Chang <chiaweic@codeaurora.org>
parent 25010e76
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1255,6 +1255,7 @@ int gsi_dealloc_evt_ring(unsigned long evt_ring_hdl)
	}

	mutex_lock(&gsi_ctx->mlock);
	reinit_completion(&ctx->compl);
	val = (((evt_ring_hdl << GSI_EE_n_EV_CH_CMD_CHID_SHFT) &
			GSI_EE_n_EV_CH_CMD_CHID_BMSK) |
		((op << GSI_EE_n_EV_CH_CMD_OPCODE_SHFT) &
@@ -1349,6 +1350,7 @@ int gsi_reset_evt_ring(unsigned long evt_ring_hdl)
	}

	mutex_lock(&gsi_ctx->mlock);
	reinit_completion(&ctx->compl);
	val = (((evt_ring_hdl << GSI_EE_n_EV_CH_CMD_CHID_SHFT) &
			GSI_EE_n_EV_CH_CMD_CHID_BMSK) |
		((op << GSI_EE_n_EV_CH_CMD_OPCODE_SHFT) &
@@ -1806,7 +1808,7 @@ int gsi_start_channel(unsigned long chan_hdl)
	}

	mutex_lock(&gsi_ctx->mlock);
	init_completion(&ctx->compl);
	reinit_completion(&ctx->compl);

	gsi_ctx->ch_dbg[chan_hdl].ch_start++;
	val = (((chan_hdl << GSI_EE_n_GSI_CH_CMD_CHID_SHFT) &
@@ -1864,7 +1866,7 @@ int gsi_stop_channel(unsigned long chan_hdl)
	}

	mutex_lock(&gsi_ctx->mlock);
	init_completion(&ctx->compl);
	reinit_completion(&ctx->compl);

	gsi_ctx->ch_dbg[chan_hdl].ch_stop++;
	val = (((chan_hdl << GSI_EE_n_GSI_CH_CMD_CHID_SHFT) &
@@ -1933,7 +1935,7 @@ int gsi_stop_db_channel(unsigned long chan_hdl)
	}

	mutex_lock(&gsi_ctx->mlock);
	init_completion(&ctx->compl);
	reinit_completion(&ctx->compl);

	gsi_ctx->ch_dbg[chan_hdl].ch_db_stop++;
	val = (((chan_hdl << GSI_EE_n_GSI_CH_CMD_CHID_SHFT) &
@@ -1999,7 +2001,7 @@ int gsi_reset_channel(unsigned long chan_hdl)
	mutex_lock(&gsi_ctx->mlock);

reset:
	init_completion(&ctx->compl);
	reinit_completion(&ctx->compl);
	gsi_ctx->ch_dbg[chan_hdl].ch_reset++;
	val = (((chan_hdl << GSI_EE_n_GSI_CH_CMD_CHID_SHFT) &
			GSI_EE_n_GSI_CH_CMD_CHID_BMSK) |
@@ -2065,7 +2067,7 @@ int gsi_dealloc_channel(unsigned long chan_hdl)
	}

	mutex_lock(&gsi_ctx->mlock);
	init_completion(&ctx->compl);
	reinit_completion(&ctx->compl);

	gsi_ctx->ch_dbg[chan_hdl].ch_de_alloc++;
	val = (((chan_hdl << GSI_EE_n_GSI_CH_CMD_CHID_SHFT) &