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

Tom Rini trini at konsulko.com
Wed Oct 4 16:05:54 CEST 2023


On Tue, Oct 03, 2023 at 03:09:01AM +0200, Heinrich Schuchardt 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>

Reviewed-by: Tom Rini <trini at konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231004/d0fb479a/attachment.sig>


More information about the U-Boot mailing list