diff mbox series

net: guard call to tftp_start() with IS_ENABLED(CONFIG_CMD_TFTPBOOT)

Message ID 20240902132511.148683-1-jerome.forissier@linaro.org
State New
Headers show
Series net: guard call to tftp_start() with IS_ENABLED(CONFIG_CMD_TFTPBOOT) | expand

Commit Message

Jerome Forissier Sept. 2, 2024, 1:25 p.m. UTC
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 | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

Comments

Tom Rini Sept. 10, 2024, 10:38 p.m. UTC | #1
On Mon, 02 Sep 2024 15:25:11 +0200, Jerome Forissier wrote:

> net_auto_load() cannot call tftp_start() if CONFIG_CMD_TFTPBOOT is
> disabled.
> 
> 

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/net/net.c b/net/net.c
index d9bc9df643f..1e0b7c85624 100644
--- 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)