byte-cntr: check pcie channel status before closing it

Check pcie channel status before call the close channel API, only
closed it when it in open state.

Change-Id: Ib3bee9575edfae0cc907baee4956d6e3a6c78d61
Signed-off-by: Yuanfang Zhang <quic_yuanfang@quicinc.com>
This commit is contained in:
Yuanfang Zhang 2022-03-08 16:01:51 +08:00 • committed by Gerrit - the friendly Code Review server
commit 224fd98c51

View file

@ -182,7 +182,7 @@ EXPORT_SYMBOL(tmc_etr_byte_cntr_stop);
static void etr_pcie_close_channel(struct byte_cntr *byte_cntr_data)
{
if (!byte_cntr_data)
if (!byte_cntr_data || !byte_cntr_data->pcie_chan_opened)
return;
mutex_lock(&byte_cntr_data->byte_cntr_lock);