diff --git a/drivers/hwtracing/coresight/coresight-byte-cntr.c b/drivers/hwtracing/coresight/coresight-byte-cntr.c index 9c500245b4e2..d85b769ea9ce 100644 --- a/drivers/hwtracing/coresight/coresight-byte-cntr.c +++ b/drivers/hwtracing/coresight/coresight-byte-cntr.c @@ -785,7 +785,7 @@ static void etr_pcie_write_work_fn(struct work_struct *work) req->snd_cmpl = 1; bytes_to_write = mhi_dev_write_channel(req); - if (bytes_to_write != PCIE_BLK_SIZE) { + if (bytes_to_write != actual) { dev_err(&tmcdrvdata->csdev->dev, "Write error %d\n", bytes_to_write); @@ -795,7 +795,7 @@ static void etr_pcie_write_work_fn(struct work_struct *work) } mutex_lock(&byte_cntr_data->byte_cntr_lock); - if (byte_cntr_data->offset + actual >= tmcdrvdata->size) + if (byte_cntr_data->offset + actual >= tmcdrvdata->sysfs_buf->size) byte_cntr_data->offset = 0; else byte_cntr_data->offset += actual; diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 323971401cb6..d2a71501bf0d 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1171,7 +1171,8 @@ static void __tmc_etr_disable_hw(struct tmc_drvdata *drvdata) { CS_UNLOCK(drvdata->base); - tmc_flush_and_stop(drvdata); + if (drvdata->out_mode != TMC_ETR_OUT_MODE_PCIE) + tmc_flush_and_stop(drvdata); /* * When operating in sysFS mode the content of the buffer needs to be * read before the TMC is disabled.