]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
arch: imx9: Fix blk_dwrite/blk_derase error checking
authorFrancois Berder <fberder@outlook.fr>
Sun, 24 May 2026 20:35:59 +0000 (22:35 +0200)
committerFabio Estevam <festevam@gmail.com>
Fri, 5 Jun 2026 15:54:55 +0000 (12:54 -0300)
blk_dwrite/blk_derase returns the number of blocks
written/erased. The existing check allowed partial
writes or partial erase to be considered successful.
Fix error handling of blk_dwrite/blk_derase by checking
that return value corresponds to the number of blocks
written/erased.

Signed-off-by: Francois Berder <fberder@outlook.fr>
arch/arm/mach-imx/imx9/qb.c

index 1a0a12de3d4f079c207fbb2a13b7cd008c6e130c..4f73db8e594628ca2069d647edbb108964d28e70 100644 (file)
@@ -304,8 +304,8 @@ static int imx_qb_blk(const char * const ifname,
                ret = blk_derase(bdesc, offset, load_size);
        }
 
-       if (!ret) {
-               printf("Failed to write to block device\n");
+       if (ret != load_size) {
+               printf("Failed to %s block device\n", save ? "write to" : "erase");
                return -EIO;
        }