diff mbox series

[3/3] pc-bios/s390-ccw/netmain: Fix error messages with regards to the TFTP server

Message ID 20250116115826.192047-4-thuth@redhat.com (mailing list archive)
State New
Headers show
Series pc-bios/s390-ccw: Fix problems related to network booting | expand

Commit Message

Thomas Huth Jan. 16, 2025, 11:58 a.m. UTC
The code in net_init_ip() currently bails out early if "rc" is less
than 0, so the if-statements that check for negative "rc" codes to
print out some specific error messages with regards to the TFTP server
are never reached. Move them earlier to bring that dead code back to
life.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 pc-bios/s390-ccw/netmain.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

Comments

Jared Rossi Jan. 16, 2025, 2:25 p.m. UTC | #1
Reviewed-by: Jared Rossi <jrossi@linux.ibm.com>

On 1/16/25 6:58 AM, Thomas Huth wrote:
> The code in net_init_ip() currently bails out early if "rc" is less
> than 0, so the if-statements that check for negative "rc" codes to
> print out some specific error messages with regards to the TFTP server
> are never reached. Move them earlier to bring that dead code back to
> life.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   pc-bios/s390-ccw/netmain.c | 19 ++++++++-----------
>   1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
> index 335ea9b63e..719a547ada 100644
> --- a/pc-bios/s390-ccw/netmain.c
> +++ b/pc-bios/s390-ccw/netmain.c
> @@ -168,6 +168,14 @@ static int net_init_ip(filename_ip_t *fn_ip)
>           if (fn_ip->ip_version == 4) {
>               set_ipv4_address(fn_ip->own_ip);
>           }
> +    } else if (rc == -2) {
> +        printf("ARP request to TFTP server (%d.%d.%d.%d) failed\n",
> +               (fn_ip->server_ip >> 24) & 0xFF, (fn_ip->server_ip >> 16) & 0xFF,
> +               (fn_ip->server_ip >>  8) & 0xFF, fn_ip->server_ip & 0xFF);
> +        return -102;
> +    } else if (rc == -4 || rc == -3) {
> +        puts("Can't obtain TFTP server IP address");
> +        return -107;
>       } else {
>           puts("Could not get IP address");
>           return -101;
> @@ -183,17 +191,6 @@ static int net_init_ip(filename_ip_t *fn_ip)
>           printf("  Using IPv6 address: %s\n", ip6_str);
>       }
>   
> -    if (rc == -2) {
> -        printf("ARP request to TFTP server (%d.%d.%d.%d) failed\n",
> -               (fn_ip->server_ip >> 24) & 0xFF, (fn_ip->server_ip >> 16) & 0xFF,
> -               (fn_ip->server_ip >>  8) & 0xFF, fn_ip->server_ip & 0xFF);
> -        return -102;
> -    }
> -    if (rc == -4 || rc == -3) {
> -        puts("Can't obtain TFTP server IP address");
> -        return -107;
> -    }
> -
>       printf("  Using TFTP server: ");
>       if (fn_ip->ip_version == 4) {
>           printf("%d.%d.%d.%d\n",
diff mbox series

Patch

diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
index 335ea9b63e..719a547ada 100644
--- a/pc-bios/s390-ccw/netmain.c
+++ b/pc-bios/s390-ccw/netmain.c
@@ -168,6 +168,14 @@  static int net_init_ip(filename_ip_t *fn_ip)
         if (fn_ip->ip_version == 4) {
             set_ipv4_address(fn_ip->own_ip);
         }
+    } else if (rc == -2) {
+        printf("ARP request to TFTP server (%d.%d.%d.%d) failed\n",
+               (fn_ip->server_ip >> 24) & 0xFF, (fn_ip->server_ip >> 16) & 0xFF,
+               (fn_ip->server_ip >>  8) & 0xFF, fn_ip->server_ip & 0xFF);
+        return -102;
+    } else if (rc == -4 || rc == -3) {
+        puts("Can't obtain TFTP server IP address");
+        return -107;
     } else {
         puts("Could not get IP address");
         return -101;
@@ -183,17 +191,6 @@  static int net_init_ip(filename_ip_t *fn_ip)
         printf("  Using IPv6 address: %s\n", ip6_str);
     }
 
-    if (rc == -2) {
-        printf("ARP request to TFTP server (%d.%d.%d.%d) failed\n",
-               (fn_ip->server_ip >> 24) & 0xFF, (fn_ip->server_ip >> 16) & 0xFF,
-               (fn_ip->server_ip >>  8) & 0xFF, fn_ip->server_ip & 0xFF);
-        return -102;
-    }
-    if (rc == -4 || rc == -3) {
-        puts("Can't obtain TFTP server IP address");
-        return -107;
-    }
-
     printf("  Using TFTP server: ");
     if (fn_ip->ip_version == 4) {
         printf("%d.%d.%d.%d\n",