[PATCH v1 2/7] sf protect: warn about failed (un)lock operation
Bernhard Kirchen
schlimmchen at gmail.com
Thu Jan 28 17:18:42 CET 2021
it is not guaranteed that there is a human readable message when the
lock or unlock operation failed. make sure there is a message emitted
by the "sf protect" implementation if the subcommand failed.
Signed-off-by: Bernhard Kirchen <bernhard.kirchen at mbconnectline.com>
---
cmd/sf.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/cmd/sf.c b/cmd/sf.c
index a991ae0d03..ecd2918cbc 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -378,7 +378,12 @@ static int do_spi_protect(int argc, char *const argv[])
ret = spi_flash_protect(flash, start, len, prot);
- return ret == 0 ? 0 : 1;
+ if (ret != 0) {
+ printf("ERROR: %slocking operation failed (%d)\n", (prot ? "" : "un"), ret);
+ return 1;
+ }
+
+ return 0;
}
#ifdef CONFIG_CMD_SF_TEST
--
2.29.2
More information about the U-Boot
mailing list