From 27242462167f678cb6ec78fa8c97f25c9557cb1e Mon Sep 17 00:00:00 2001 From: Andrew Goodbody Date: Fri, 1 Aug 2025 10:54:06 +0100 Subject: [PATCH] mtd: rawnand: mxs_nand: Ensure err is set for error path In mxs_nand_init_ctrl there are a couple of error paths that do not set err which could lead to the errors being silently ignored despite the function not completing. Rather than just using if to detect these errors use err to collect the error return value from the called functions. This issue was found by Smatch. Signed-off-by: Andrew Goodbody Reviewed-by: Michael Trimarchi --- drivers/mtd/nand/raw/mxs_nand.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c index ba67466069b..fecf1f5ba91 100644 --- a/drivers/mtd/nand/raw/mxs_nand.c +++ b/drivers/mtd/nand/raw/mxs_nand.c @@ -1640,10 +1640,12 @@ int mxs_nand_init_ctrl(struct mxs_nand_info *nand_info) nand->setup_data_interface = mxs_nand_setup_interface; /* first scan to find the device and get the page size */ - if (nand_scan_ident(mtd, CONFIG_SYS_MAX_NAND_DEVICE, NULL)) + err = nand_scan_ident(mtd, CONFIG_SYS_MAX_NAND_DEVICE, NULL); + if (err) goto err_free_buffers; - if (mxs_nand_setup_ecc(mtd)) + err = mxs_nand_setup_ecc(mtd); + if (err) goto err_free_buffers; nand->ecc.read_page = mxs_nand_ecc_read_page; -- 2.47.2