Skip to contentSkip to conversation

tools: env: return error if ubi_update_start() fails

PATCH New Martin Hundebøll 2 participants 2 messages Nov 30, 2020 – Jan 23, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: env: return error if ubi_update_start() fails

The UBI_IOCVOLUP ioctl can fail if exclusive access to the volume isn't obtained. If this happens, the flush operation doesn't return error, leaving the caller without knowledge of missing flush.

Fix this by forwarding the error (-1) from ubi_update_start().

Fixes 34255b92e6e ("tools: env: Add support for direct read/write UBI volumes")
---
 tools/env/fw_env.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/env/fw_env.c +1 -1
index 66cb9d2a25..2a61a5d6f0 100644
@@ -1208,7 +1208,7 @@ static int flash_write(int fd_current, int fd_target, int dev_target)
 
 	if (IS_UBI(dev_target)) {
 		if (ubi_update_start(fd_target, CUR_ENVSIZE) < 0)
-			return 0;
+			return -1;
 		return ubi_write(fd_target, environment.image, CUR_ENVSIZE);
 	}
 
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/1 tools: env: return error if ubi_update_start() fails

Quoted 8 lines · Martin Hundeb?ll

The UBI_IOCVOLUP ioctl can fail if exclusive access to the volume isn't obtained. If this happens, the flush operation doesn't return error, leaving the caller without knowledge of missing flush.

Fix this by forwarding the error (-1) from ubi_update_start().

Fixes 34255b92e6e ("tools: env: Add support for direct read/write UBI volumes")

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210123/a46b99fd/attachment.sig>