U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yannic Moog <Y.Moog@phytec.de>
To: Leonard Anderweit <L.Anderweit@phytec.de>,
	"u-boot@lists.denx.de" <u-boot@lists.denx.de>
Cc: "joe.hershberger@ni.com" <joe.hershberger@ni.com>,
	"rfried.dev@gmail.com" <rfried.dev@gmail.com>,
	"jerome.forissier@linaro.org" <jerome.forissier@linaro.org>
Subject: Re: [PATCH] net: tftp: Remove tftp_init_load_addr error path
Date: Thu, 20 Nov 2025 08:07:35 +0000	[thread overview]
Message-ID: <f6796887efbdc39e906067bd6737a3f82ff4aee0.camel@phytec.de> (raw)
In-Reply-To: <20251119083709.2000844-1-l.anderweit@phytec.de>

Hi Leonard,

On Wed, 2025-11-19 at 09:37 +0100, Leonard Anderweit wrote:
> tftp_init_load_addr() always returns 0 since commit af45c84871e4
> ("tftp:
> rework the logic to validate the load address"), so we don't need to
> check if it failed and can remove the error handling.

Idea looks good,

> 
> Signed-off-by: Leonard Anderweit <l.anderweit@phytec.de>
> ---
>  net/tftp.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/net/tftp.c b/net/tftp.c
> index 1760877107fa..18f72b6a74ac 100644
> --- a/net/tftp.c
> +++ b/net/tftp.c
> @@ -901,13 +901,7 @@ void tftp_start(enum proto_t protocol)
>  	} else
>  #endif
>  	{
> -		if (tftp_init_load_addr()) {
> -			eth_halt();
> -			net_set_state(NETLOOP_FAIL);
> -			puts("\nTFTP error: ");
> -			puts("trying to overwrite reserved
> memory...\n");
> -			return;
> -		}
> +		tftp_init_load_addr();

since return value is unused then, change to

static void tftp_init_load_addr()

Yannic

>  		printf("Load address: 0x%lx\n", tftp_load_addr);
>  		puts("Loading: *\b");
>  		tftp_state = STATE_SEND_RRQ;
> @@ -953,12 +947,7 @@ void tftp_start_server(void)
>  {
>  	tftp_filename[0] = 0;
>  
> -	if (tftp_init_load_addr()) {
> -		eth_halt();
> -		net_set_state(NETLOOP_FAIL);
> -		puts("\nTFTP error: trying to overwrite reserved
> memory...\n");
> -		return;
> -	}
> +	tftp_init_load_addr();
>  	printf("Using %s device\n", eth_get_name());
>  	printf("Listening for TFTP transfer on %pI4\n", &net_ip);
>  	printf("Load address: 0x%lx\n", tftp_load_addr);

      reply	other threads:[~2025-11-20  8:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19  8:37 [PATCH] net: tftp: Remove tftp_init_load_addr error path Leonard Anderweit
2025-11-20  8:07 ` Yannic Moog [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f6796887efbdc39e906067bd6737a3f82ff4aee0.camel@phytec.de \
    --to=y.moog@phytec.de \
    --cc=L.Anderweit@phytec.de \
    --cc=jerome.forissier@linaro.org \
    --cc=joe.hershberger@ni.com \
    --cc=rfried.dev@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox