[U-Boot] [PATCH 14/24] sandbox: Correct error handling in state_read_file()

Simon Glass sjg at chromium.org
Mon May 4 19:31:07 CEST 2015


This function should return a useful error for U-Boot, rather than -1.

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

 arch/sandbox/cpu/state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index 033958c..cae731c 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -51,7 +51,7 @@ static int state_read_file(struct sandbox_state *state, const char *fname)
 	ret = os_get_filesize(fname, &size);
 	if (ret < 0) {
 		printf("Cannot find sandbox state file '%s'\n", fname);
-		return ret;
+		return -ENOENT;
 	}
 	state->state_fdt = os_malloc(size);
 	if (!state->state_fdt) {
-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list