[PATCH v2 1/4] cli: run_commandf(): small fixups
Simon Glass
sjg at chromium.org
Mon Mar 20 19:40:00 CET 2023
On Mon, 20 Mar 2023 at 21:23, Evgeny Bachinin <EABachinin at sberdevices.ru> wrote:
>
> * 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 at sberdevices.ru>
> ---
> Changes for v2:
> - s/pr_err/pr_debug/ to reduce code size for rare errors
> - s/EINVAL/ENOSPC/
> - replace on-stack buffer with global console_buffer[]
> - use not full (CONFIG_SYS_CBSIZE + 1) space of console_buffer, because
> interpreters return no more than CONFIG_SYS_CBSIZE (including \0),
> hence we use CONFIG_SYS_CBSIZE as a max command size for run_commandf()
> - not apply Reviewed-by due to changes above
>
> common/cli.c | 25 +++++++++++++++++++------
> include/command.h | 13 ++++++++++---
> 2 files changed, 29 insertions(+), 9 deletions(-)
>
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the U-Boot
mailing list