qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
	Jared Rossi <jrossi@linux.ibm.com>,
	Eric Farman <farman@linux.ibm.com>
Subject: [PULL 7/9] pc-bios/s390-ccw/netmain: Fix error messages with regards to the TFTP server
Date: Tue, 21 Jan 2025 11:56:09 +0100	[thread overview]
Message-ID: <20250121105613.1286672-8-thuth@redhat.com> (raw)
In-Reply-To: <20250121105613.1286672-1-thuth@redhat.com>

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.

Reviewed-by: Jared Rossi <jrossi@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Tested-by: Jared Rossi <jrossi@linux.ibm.com>
Message-ID: <20250116115826.192047-4-thuth@redhat.com>
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",
-- 
2.48.1



  parent reply	other threads:[~2025-01-21 10:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 10:56 [PULL 0/9] s390x and test patches 2025-01-21 Thomas Huth
2025-01-21 10:56 ` [PULL 1/9] tests/functional: Convert the kvm_xen_guest avocado test Thomas Huth
2025-01-21 10:56 ` [PULL 2/9] MAINTAINERS: Remove myself as Avocado Framework reviewer Thomas Huth
2025-01-21 10:56 ` [PULL 3/9] crypto: fix bogus error benchmarking pbkdf on fast machines Thomas Huth
2025-01-21 10:56 ` [PULL 4/9] hw/s390x: Fix crash that occurs when inspecting older versioned machines types Thomas Huth
2025-01-21 10:56 ` [PULL 5/9] pc-bios/s390-ccw/virtio: Add a function to reset a virtio device Thomas Huth
2025-01-21 10:56 ` [PULL 6/9] pc-bios/s390-ccw: Fix boot problem with virtio-net devices Thomas Huth
2025-01-21 10:56 ` Thomas Huth [this message]
2025-01-21 10:56 ` [PULL 8/9] pc-bios/s390-ccw: Abort IPL on invalid loadparm Thomas Huth
2025-01-21 10:56 ` [PULL 9/9] pc-bios: Update the s390 bios images with the recent changes Thomas Huth
2025-01-22  0:27 ` [PULL 0/9] s390x and test patches 2025-01-21 Stefan Hajnoczi
2025-01-22  6:25   ` Thomas Huth

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=20250121105613.1286672-8-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=jrossi@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).