arch: imx9: Fix blk_dwrite/blk_derase error checking

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>
This commit is contained in:
Francois Berder
2026-05-24 22:35:59 +02:00
committed by Fabio Estevam
parent dfd83eab76
commit 4feabb2b8a

View 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;
}