cxl/mem: Fix for the index of Clear Event Record Handle
authorYuquan Wang <wangyuquan1236@phytium.com.cn>
Mon, 18 Mar 2024 02:29:28 +0000 (10:29 +0800)
committerDave Jiang <dave.jiang@intel.com>
Tue, 26 Mar 2024 19:06:21 +0000 (12:06 -0700)
The dev_dbg info for Clear Event Records mailbox command would report
the handle of the next record to clear not the current one.

This was because the index 'i' had incremented before printing the
current handle value.

Fixes: 6ebe28f9ec72 ("cxl/mem: Read, trace, and clear events on driver load")
Signed-off-by: Yuquan Wang <wangyuquan1236@phytium.com.cn>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/mbox.c

index 9adda4795eb786b8658b573dd1e79befbad52255..50146161887d5aee0974c99635a344f27e0cecac 100644 (file)
@@ -915,7 +915,7 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds,
 
                payload->handles[i++] = gen->hdr.handle;
                dev_dbg(mds->cxlds.dev, "Event log '%d': Clearing %u\n", log,
-                       le16_to_cpu(payload->handles[i]));
+                       le16_to_cpu(payload->handles[i - 1]));
 
                if (i == max_handles) {
                        payload->nr_recs = i;