net: tftp: Remove tftp_init_load_addr error path
PATCH 1/1 net: tftp: Remove tftp_init_load_addr error path
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.
--- net/tftp.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
net/tftp.c +2 -13
@@ -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 ();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);
Signature · 1 line
2.43.0
Hi Leonard,
Quoted 4 lines · Leonard Anderweit
tftp_init_load_addr()always returns 0 since commitaf45c84871e4("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,
Quoted 13 lines
Signed-off-by Leonard Anderweit <[email protected]>---
net/tftp.c | 15 ++-------------1 file changed, 2 insertions(+), 13 deletions(-)net/tftp.c +0
-0@@ -901,13 +901,7 @@ void tftp_start(enum proto_t protocol) } else #endif
net/tftp.c void tftp_start(enum proto_t protocol) · line 905
Quoted 10 lines
net/tftp.c +1
-7{ -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
Quoted 18 lines
net/tftp.c +0
-0printf("Load address: 0x%lx\n", tftp_load_addr); puts("Loading: *\b");
tftp_state=STATE_SEND_RRQ;net/tftp.c +0
-0@@ -953,12 +947,7 @@ void tftp_start_server(void) { tftp_filename[0] = 0;net/tftp.c +0
-4-if (tftp_init_load_addr ()) { -eth_halt (); -net_set_state (NETLOOP_FAIL ); - puts("\nTFTP error: trying to overwrite reservedmemory...\n");
net/tftp.c +1
-2-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);