[PATCH v3 1/1] input: avoid NULL dereference

Simon Glass sjg at chromium.org
Wed Oct 4 04:10:55 CEST 2023


On Mon, 2 Oct 2023 at 19:09, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
> Before using the result of env_get("stdin") we must check if it is NULL.
>
> Avoid #if. This resolves the -Wunused-but-set-variable issue and we don't
> need a dummy assignment in the else branch. Anyway this warning is
> disabled in the Makefile.
>
> For sake of readability use an early return after the configuration check.
>
> Checking CONFIG_SPL_BUILD is incorrect as env_get() is only defined if
> CONFIG_$(SPL_TPL)ENV_SUPPORT=y.
>
> Fixes: 985ca3945fa3 ("spl: input: Allow input in SPL and TPL")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> ---
> v2:
>         avoid #if
>
> v3:
>         use an early return after configuration check
>         remove CONFIG_SPL_BUILD check
> ---
>  drivers/input/input.c | 25 +++++++++++++++----------
>  1 file changed, 15 insertions(+), 10 deletions(-)

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


More information about the U-Boot mailing list