summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorSkylar Chang <chiaweic@codeaurora.org>2017-02-06 13:29:35 -0800
committerSkylar Chang <chiaweic@codeaurora.org>2017-02-06 13:29:35 -0800
commitfc168a68ae88c654702b18189c83b75db73c6d37 (patch)
treefe8c12271901489ae69c119bd944ab4e2b68ed8d /drivers/platform
parent20e1ed9259bf1c7c40b76b13d74d476608cc1d49 (diff)
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: Ady Abraham <adya@qti.qualcomm.com> Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/msm/gsi/gsi.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/platform/msm/gsi/gsi.c b/drivers/platform/msm/gsi/gsi.c
index 58c1704a875c..188388bc97a0 100644
--- a/drivers/platform/msm/gsi/gsi.c
+++ b/drivers/platform/msm/gsi/gsi.c
@@ -1245,6 +1245,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) &
@@ -1339,6 +1340,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) &
@@ -1796,7 +1798,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) &
@@ -1854,7 +1856,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) &
@@ -1923,7 +1925,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) &
@@ -1989,7 +1991,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) |
@@ -2055,7 +2057,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) &