diff --git a/drivers/hwtracing/coresight/coresight-byte-cntr.c b/drivers/hwtracing/coresight/coresight-byte-cntr.c index 18a44f24384d..907a71db6070 100644 --- a/drivers/hwtracing/coresight/coresight-byte-cntr.c +++ b/drivers/hwtracing/coresight/coresight-byte-cntr.c @@ -184,7 +184,8 @@ static int tmc_etr_byte_cntr_release(struct inode *in, struct file *fp) mutex_lock(&byte_cntr_data->byte_cntr_lock); byte_cntr_data->read_active = false; - coresight_csr_set_byte_cntr(byte_cntr_data->csr, 0); + if (byte_cntr_data->enable) + coresight_csr_set_byte_cntr(byte_cntr_data->csr, 0); mutex_unlock(&byte_cntr_data->byte_cntr_lock); return 0;