mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
trace: Tidy up error returns
At present many functions in this file return -1. Update them to return a valid error code. Also tidy up the 'return' statements at the same time, since these should have a blank line before them. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
f611a46ef1
commit
f564d09608
1 changed files with 9 additions and 5 deletions
14
lib/trace.c
14
lib/trace.c
|
@ -183,7 +183,8 @@ int trace_list_functions(void *buff, int buff_size, unsigned int *needed)
|
|||
/* Work out how must of the buffer we used */
|
||||
*needed = ptr - buff;
|
||||
if (ptr > end)
|
||||
return -1;
|
||||
return -ENOSPC;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -227,7 +228,8 @@ int trace_list_calls(void *buff, int buff_size, unsigned *needed)
|
|||
/* Work out how must of the buffer we used */
|
||||
*needed = ptr - buff;
|
||||
if (ptr > end)
|
||||
return -1;
|
||||
return -ENOSPC;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -302,7 +304,7 @@ int __attribute__((no_instrument_function)) trace_init(void *buff,
|
|||
memcpy(buff, hdr, used);
|
||||
#else
|
||||
puts("trace: already enabled\n");
|
||||
return -1;
|
||||
return -EALREADY;
|
||||
#endif
|
||||
}
|
||||
hdr = (struct trace_hdr *)buff;
|
||||
|
@ -310,7 +312,7 @@ int __attribute__((no_instrument_function)) trace_init(void *buff,
|
|||
if (needed > buff_size) {
|
||||
printf("trace: buffer size %zd bytes: at least %zd needed\n",
|
||||
buff_size, needed);
|
||||
return -1;
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
if (was_disabled)
|
||||
|
@ -327,6 +329,7 @@ int __attribute__((no_instrument_function)) trace_init(void *buff,
|
|||
hdr->depth_limit = 15;
|
||||
trace_enabled = 1;
|
||||
trace_inited = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -346,7 +349,7 @@ int __attribute__((no_instrument_function)) trace_early_init(void)
|
|||
if (needed > buff_size) {
|
||||
printf("trace: buffer size is %zd bytes, at least %zd needed\n",
|
||||
buff_size, needed);
|
||||
return -1;
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
memset(hdr, '\0', needed);
|
||||
|
@ -361,6 +364,7 @@ int __attribute__((no_instrument_function)) trace_early_init(void)
|
|||
printf("trace: early enable at %08x\n", CONFIG_TRACE_EARLY_ADDR);
|
||||
|
||||
trace_enabled = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue