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

Tom Rini trini at ti.com
Mon Oct 27 15:50:35 CET 2014


On Sun, Oct 05, 2014 at 06:39:07PM +0200, Maxime Hadjinlian wrote:

> 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;
> -		}

Moving the check to TftpServer() seems fine but right here you've also
removed the check from the NFS cmd which is wrong.  This needs to be
re-worked so that the current check is under #if defined(CONFIG_CMD_NFS)
and we continue case'ing TFTPGET/TFTPPUT through the common part that
follows and so forth.  Thanks!

>  #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
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141027/612213f4/attachment.pgp>


More information about the U-Boot mailing list