mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 19:11:53 +00:00
cli: run_commandf(): small fixups
* vsnprintf() can truncate cmd, hence it makes no sense to launch such command (it's broken). Moreover, it's better to signalize to the caller about such case (for facilitating debugging or bug hunting). * Fix kernel-doc warnings: include/command.h:264: info: Scanning doc for run_commandf include/command.h:268: warning: contents before sections include/command.h:271: warning: No description found for return value of 'run_commandf' * Add printf-like format attribute to validate at compile-time the format string against parameters's type. * Fix compilation error in case of -Wall, -Werror, -Wextra: error: variable ‘i’ set but not used [-Werror=unused-but-set-variable] * Drop extra ret variable. Signed-off-by: Evgeny Bachinin <EABachinin@sberdevices.ru> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
0798a1ce0f
commit
26f923c7cf
2 changed files with 29 additions and 9 deletions
|
@ -13,6 +13,8 @@
|
|||
#include <env.h>
|
||||
#include <linker_lists.h>
|
||||
|
||||
#include <linux/compiler_attributes.h>
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
@ -260,12 +262,17 @@ int run_command_repeatable(const char *cmd, int flag);
|
|||
/**
|
||||
* run_commandf() - Run a command created by a format string
|
||||
*
|
||||
* The command cannot be larger than 127 characters
|
||||
*
|
||||
* @fmt: printf() format string
|
||||
* @...: Arguments to use (flag is always 0)
|
||||
*
|
||||
* The command cannot be larger than (CONFIG_SYS_CBSIZE - 1) characters.
|
||||
*
|
||||
* Return:
|
||||
* Returns 0 on success, -EIO if internal output error occurred, -ENOSPC in
|
||||
* case of 'fmt' string truncation, or != 0 on error, specific for
|
||||
* run_command().
|
||||
*/
|
||||
int run_commandf(const char *fmt, ...);
|
||||
int run_commandf(const char *fmt, ...) __printf(1, 2);
|
||||
|
||||
/**
|
||||
* Run a list of commands separated by ; or even \0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue