[U-Boot] [PATCH] tftp: Displace check for server ip

Maxime Hadjinlian maxime.hadjinlian at gmail.com
Sun Oct 5 18:39:07 CEST 2014


If for some reason, 'serverip' is not set, and you are passing the
remote IP on the command line, the tftp command will fail, stating that
the 'serverip' is not set.

By displacing this check, it fixes the issues.

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian at gmail.com>
---

 net/net.c  | 6 ------
 net/tftp.c | 4 ++++
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/net/net.c b/net/net.c
index 722089f..044ee71 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1235,12 +1235,6 @@ static int net_check_prereq(enum proto_t protocol)
 #if defined(CONFIG_CMD_NFS)
 	case NFS:
 #endif
-	case TFTPGET:
-	case TFTPPUT:
-		if (NetServerIP == 0) {
-			puts("*** ERROR: `serverip' not set\n");
-			return 1;
-		}
 #if	defined(CONFIG_CMD_PING) || defined(CONFIG_CMD_SNTP) || \
 	defined(CONFIG_CMD_DNS)
 common:
diff --git a/net/tftp.c b/net/tftp.c
index 966d1cf..eb93df5 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -736,6 +736,10 @@ void TftpStart(enum proto_t protocol)
 			tftp_filename[MAX_LEN-1] = 0;
 		}
 	}
+	if (TftpRemoteIP == 0) {
+		printf("*** ERRROR: No server IP found.\n");
+		return;
+	}
 
 	printf("Using %s device\n", eth_get_name());
 	printf("TFTP %s server %pI4; our IP address is %pI4",
-- 
2.1.1



More information about the U-Boot mailing list