[PATCH] net: tftp: Remove tftp_init_load_addr error path
Yannic Moog
Y.Moog at phytec.de
Thu Nov 20 09:07:35 CET 2025
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 at 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);
More information about the U-Boot
mailing list