[U-Boot] [PATCH v2 05/14] Reverse the meaning of the fit_config_verify() return code

Simon Glass sjg at chromium.org
Thu Jun 12 15:24:45 CEST 2014


It is more common to have 0 mean OK, and -ve mean error. Change this
function to work the same way to avoid confusion.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2: None

 common/cmd_fdt.c       | 2 +-
 common/image-fit.c     | 2 +-
 common/image-sig.c     | 4 ++--
 tools/fit_check_sign.c | 3 +--
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index a6744ed..f2ad2a3 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -612,7 +612,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		}
 
 		ret = fit_config_verify(working_fdt, cfg_noffset);
-		if (ret == 1)
+		if (ret == 0)
 			return CMD_RET_SUCCESS;
 		else
 			return CMD_RET_FAILURE;
diff --git a/common/image-fit.c b/common/image-fit.c
index 732505a..40c7e27 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1534,7 +1534,7 @@ int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr,
 			images->fit_uname_cfg = fit_uname_config;
 			if (IMAGE_ENABLE_VERIFY && images->verify) {
 				puts("   Verifying Hash Integrity ... ");
-				if (!fit_config_verify(fit, cfg_noffset)) {
+				if (fit_config_verify(fit, cfg_noffset)) {
 					puts("Bad Data Hash\n");
 					bootstage_error(bootstage_id +
 						BOOTSTAGE_SUB_HASH);
diff --git a/common/image-sig.c b/common/image-sig.c
index 72284eb..48788f9 100644
--- a/common/image-sig.c
+++ b/common/image-sig.c
@@ -467,6 +467,6 @@ int fit_config_verify_required_sigs(const void *fit, int conf_noffset,
 
 int fit_config_verify(const void *fit, int conf_noffset)
 {
-	return !fit_config_verify_required_sigs(fit, conf_noffset,
-						gd_fdt_blob());
+	return fit_config_verify_required_sigs(fit, conf_noffset,
+					       gd_fdt_blob());
 }
diff --git a/tools/fit_check_sign.c b/tools/fit_check_sign.c
index e1198bc..768be2f 100644
--- a/tools/fit_check_sign.c
+++ b/tools/fit_check_sign.c
@@ -80,8 +80,7 @@ int main(int argc, char **argv)
 
 	image_set_host_blob(key_blob);
 	ret = fit_check_sign(fit_blob, key_blob);
-
-	if (ret)
+	if (!ret)
 		ret = EXIT_SUCCESS;
 	else
 		ret = EXIT_FAILURE;
-- 
2.0.0.526.g5318336



More information about the U-Boot mailing list