]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: guard call to tftp_start() with IS_ENABLED(CONFIG_CMD_TFTPBOOT)
authorJerome Forissier <jerome.forissier@linaro.org>
Mon, 2 Sep 2024 13:25:11 +0000 (15:25 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 10 Sep 2024 19:08:24 +0000 (13:08 -0600)
net_auto_load() cannot call tftp_start() if CONFIG_CMD_TFTPBOOT is
disabled.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
net/net.c

index d9bc9df643f9b7e827cfe685f301a5535240bc1d..1e0b7c856244db09ebd45fe6305598fdcc134958 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -334,17 +334,22 @@ void net_auto_load(void)
                net_set_state(NETLOOP_SUCCESS);
                return;
        }
-       if (net_check_prereq(TFTPGET)) {
-/* We aren't expecting to get a serverip, so just accept the assigned IP */
-               if (IS_ENABLED(CONFIG_BOOTP_SERVERIP)) {
-                       net_set_state(NETLOOP_SUCCESS);
-               } else {
-                       printf("Cannot autoload with TFTPGET\n");
-                       net_set_state(NETLOOP_FAIL);
+       if (IS_ENABLED(CONFIG_CMD_TFTPBOOT)) {
+               if (net_check_prereq(TFTPGET)) {
+                       /*
+                        * We aren't expecting to get a serverip, so just
+                        * accept the assigned IP
+                        */
+                       if (IS_ENABLED(CONFIG_BOOTP_SERVERIP)) {
+                               net_set_state(NETLOOP_SUCCESS);
+                       } else {
+                               printf("Cannot autoload with TFTPGET\n");
+                               net_set_state(NETLOOP_FAIL);
+                       }
+                       return;
                }
-               return;
+               tftp_start(TFTPGET);
        }
-       tftp_start(TFTPGET);
 }
 
 static int net_init_loop(void)