All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Juraj Marcin" <jmarcin@redhat.com>,
	"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Subject: [PATCH 1/2] migration: simplify error reporting after channel read
Date: Fri,  1 Aug 2025 18:02:11 +0100	[thread overview]
Message-ID: <20250801170212.54409-2-berrange@redhat.com> (raw)
In-Reply-To: <20250801170212.54409-1-berrange@redhat.com>

The code handling the return value of qio_channel_read proceses
len == 0 (EOF) separately from len < 1  (error), but in both
cases ends up calling qemu_file_set_error_obj() with -EIO as the
errno. This logic can be merged into one codepath to simplify it.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 migration/qemu-file.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index b6ac190034..8ee44c5ac9 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -348,17 +348,13 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEMUFile *f)
             } else {
                 qio_channel_wait(f->ioc, G_IO_IN);
             }
-        } else if (len < 0) {
-            len = -EIO;
         }
     } while (len == QIO_CHANNEL_ERR_BLOCK);
 
     if (len > 0) {
         f->buf_size += len;
-    } else if (len == 0) {
-        qemu_file_set_error_obj(f, -EIO, local_error);
     } else {
-        qemu_file_set_error_obj(f, len, local_error);
+        qemu_file_set_error_obj(f, -EIO, local_error);
     }
 
     for (int i = 0; i < nfd; i++) {
-- 
2.50.1



  reply	other threads:[~2025-08-01 18:36 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-01 17:02 [PATCH for-10.1 0/2] migration: actually make gnutls workaround functional Daniel P. Berrangé
2025-08-01 17:02 ` Daniel P. Berrangé [this message]
2025-08-04 10:18   ` [PATCH 1/2] migration: simplify error reporting after channel read Prasad Pandit
2025-08-04 10:22     ` Daniel P. Berrangé
2025-08-04 11:03       ` Prasad Pandit
2025-08-06  0:41   ` Peter Xu
2025-08-01 17:02 ` [PATCH 2/2] migration: fix workaround for gnutls thread safety Daniel P. Berrangé
2025-08-04 10:29   ` Prasad Pandit
2025-08-04 18:13   ` Fabiano Rosas
2025-08-04 17:53 ` [PATCH for-10.1 0/2] migration: actually make gnutls workaround functional Juraj Marcin
2025-08-04 19:27   ` Fabiano Rosas
2025-08-05 10:09     ` Daniel P. Berrangé
2025-08-05 13:44       ` Fabiano Rosas
2025-08-05 14:18         ` Daniel P. Berrangé
2025-08-05 15:28           ` Fabiano Rosas
2025-08-05 14:52         ` Juraj Marcin
2025-08-06 14:54           ` Peter Xu
2025-09-29 15:58 ` Peter Xu
2025-09-29 16:55   ` Daniel P. Berrangé
2025-09-29 17:31     ` Peter Xu

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=20250801170212.54409-2-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=farosas@suse.de \
    --cc=jmarcin@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.