]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Apr 2024 09:19:27 +0000 (11:19 +0200)
[ Upstream commit b7c59b038c656214f56432867056997c2e0fc268 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/cxl/core/mbox.c

index b12986b968da4f8d66d0fe80bb2b2c3d9ca9025b..e5f3592e54191d2209e77e433868b60e550fcdaf 100644 (file)
@@ -928,7 +928,7 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds,
        for (cnt = 0; cnt < total; cnt++) {
                payload->handles[i++] = get_pl->records[cnt].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;