diff mbox

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

Message ID 1430760687-28505-15-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass May 4, 2015, 5:31 p.m. UTC
This function should return a useful error for U-Boot, rather than -1.

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

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

Comments

Joe Hershberger May 4, 2015, 9:12 p.m. UTC | #1
Hi Simon,

On Mon, May 4, 2015 at 12:31 PM, Simon Glass <sjg@chromium.org> wrote:
> This function should return a useful error for U-Boot, rather than -1.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Simon Glass May 12, 2015, 10:41 p.m. UTC | #2
On 4 May 2015 at 15:12, Joe Hershberger <joe.hershberger@gmail.com> wrote:
> Hi Simon,
>
> On Mon, May 4, 2015 at 12:31 PM, Simon Glass <sjg@chromium.org> wrote:
>> This function should return a useful error for U-Boot, rather than -1.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>

Applied to u-boot-dm.
diff mbox

Patch

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) {