[PATCH] net: guard call to tftp_start() with #if defined(CONFIG_CMD_TFTPBOOT)

Quentin Schulz quentin.schulz at cherry.de
Mon Sep 2 15:09:03 CEST 2024


Hi Jerome,

On 9/2/24 2:59 PM, Jerome Forissier wrote:
> net_auto_load() cannot call tftp_start() if CONFIG_CMD_TFTPBOOT is
> disabled.
> 
> Signed-off-by: Jerome Forissier <jerome.forissier at linaro.org>
> ---
>   net/net.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/net/net.c b/net/net.c
> index d9bc9df643f..35961ba1c7d 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -334,6 +334,7 @@ void net_auto_load(void)
>   		net_set_state(NETLOOP_SUCCESS);
>   		return;
>   	}
> +#if defined(CONFIG_CMD_TFTPBOOT)

I think we're supposed to use if IS_ENABLED(CONFIG_CMD_TFTPBOOT) now.

Additionally, it's highly recommended to rather use "normal" if's 
wherever possible, i.e.:

         if (IS_ENABLED(CONFIG_CMD_TFTPBOOT)) {
             if (net_check_prereq(TFTPGET)) {
                 if (IS_ENABLED(CONFIG_BOOTP_SERVERIP)) {
[...]
                 return;
             }
             tftp_start(TFTPGET);
         }
     }

Would that work?

Cheers,
Quentin


More information about the U-Boot mailing list