[PATCH 3/3] cxl/memdev: Don't mask an earlier partition's poison query error

Dave Jiang <[email protected]>
Newsgroups org.kernel.vger.linux-cxl
Message-ID <[email protected]>
cxl_get_poison_by_memdev() reassigns rc every partition iteration with
no early exit, so an error from an earlier partition (e.g. -EIO on
partition 0) is overwritten when a later partition succeeds, hiding the
failure from the trigger_poison_list sysfs write.

Break on the first failure, after the -EFAULT-on-RAM exception that
intentionally tolerates devices without volatile poison-list support.

Fixes: be5cbd084027 ("cxl: Kill enum cxl_decoder_mode")
Reported-by: [email protected]
Closes: https://sashiko.dev/#/patchset/[email protected]?part=5
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Dave Jiang <[email protected]>
---
 drivers/cxl/core/memdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
index 33a3d2e7b13a..8718964b9c5e 100644
--- a/drivers/cxl/core/memdev.c
+++ b/drivers/cxl/core/memdev.c
@@ -231,6 +231,8 @@ static int cxl_get_poison_by_memdev(struct cxl_memdev *cxlmd)
 		 */
 		if (rc == -EFAULT && cxlds->part[i].mode == CXL_PARTMODE_RAM)
 			rc = 0;
+		if (rc)
+			break;
 	}
 	return rc;
 }
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.