[PATCH] cmd: clone: report destination block number on dest write error

Naveen Kumar Chaudhary naveen.osdev at gmail.com
Fri Jun 26 05:45:42 CEST 2026


The error path of the destination blk_dwrite() prints srcblk, which
refers to the source device's block counter and is unrelated to the
write that just failed. This produces misleading diagnostics that
point at the wrong block on the wrong device when a clone aborts on
a write error.

Print destblk so the message identifies the block that actually
failed, mirroring the existing "Src read error @blk %ld" message
above which correctly uses srcblk.

Fixes: 4a4830cf915 ("cmd: add clone command")
Signed-off-by: Naveen Kumar Chaudhary <naveen.osdev at gmail.com>
---
 cmd/clone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/clone.c b/cmd/clone.c
index 1f3cff1836d..371f06d917a 100644
--- a/cmd/clone.c
+++ b/cmd/clone.c
@@ -97,7 +97,7 @@ read:
 write:
 		ret = blk_dwrite(destdesc, destblk, towrite, buf + offset);
 		if (ret < 0) {
-			printf("Dest write error @blk %ld\n", srcblk);
+			printf("Dest write error @blk %ld\n", destblk);
 			goto exit;
 		}
 		wrcnt += ret * destbz;
-- 
2.43.0



More information about the U-Boot mailing list