All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Jerome Forissier <jerome@forissier.org>,
	"Daniel P . Berrange" <berrange@redhat.com>,
	Greg Kurz <groug@kaod.org>
Subject: [PULL 05/28] Clean up some calls to ignore Error objects the right way
Date: Thu,  2 Jul 2020 13:09:08 +0200	[thread overview]
Message-ID: <20200702110931.2953148-6-armbru@redhat.com> (raw)
In-Reply-To: <20200702110931.2953148-1-armbru@redhat.com>

Receiving the error in a local variable only to free it is less clear
(and also less efficient) than passing NULL.  Clean up.

Cc: Daniel P. Berrange <berrange@redhat.com>
Cc: Jerome Forissier <jerome@forissier.org>
CC: Greg Kurz <groug@kaod.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: <20200630090351.1247703-4-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 chardev/char-socket.c | 6 ++----
 hw/9pfs/9p.c          | 6 ++----
 hw/arm/virt.c         | 4 +---
 hw/ppc/spapr_drc.c    | 4 +---
 ui/vnc.c              | 3 +--
 5 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 569d54c144..5758d9900f 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -817,22 +817,20 @@ static void tcp_chr_tls_init(Chardev *chr)
 {
     SocketChardev *s = SOCKET_CHARDEV(chr);
     QIOChannelTLS *tioc;
-    Error *err = NULL;
     gchar *name;
 
     if (s->is_listen) {
         tioc = qio_channel_tls_new_server(
             s->ioc, s->tls_creds,
             s->tls_authz,
-            &err);
+            NULL);
     } else {
         tioc = qio_channel_tls_new_client(
             s->ioc, s->tls_creds,
             s->addr->u.inet.host,
-            &err);
+            NULL);
     }
     if (tioc == NULL) {
-        error_free(err);
         tcp_chr_disconnect(chr);
         return;
     }
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 45a788f6e6..9755fba9a9 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -1399,7 +1399,6 @@ static void coroutine_fn v9fs_attach(void *opaque)
     size_t offset = 7;
     V9fsQID qid;
     ssize_t err;
-    Error *local_err = NULL;
 
     v9fs_string_init(&uname);
     v9fs_string_init(&aname);
@@ -1437,9 +1436,8 @@ static void coroutine_fn v9fs_attach(void *opaque)
         error_setg(&s->migration_blocker,
                    "Migration is disabled when VirtFS export path '%s' is mounted in the guest using mount_tag '%s'",
                    s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag);
-        err = migrate_add_blocker(s->migration_blocker, &local_err);
-        if (local_err) {
-            error_free(local_err);
+        err = migrate_add_blocker(s->migration_blocker, NULL);
+        if (err < 0) {
             error_free(s->migration_blocker);
             s->migration_blocker = NULL;
             clunk_fid(s, fid);
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index cd0834ce7f..af3050bc4b 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -217,11 +217,9 @@ static bool cpu_type_valid(const char *cpu)
 
 static void create_kaslr_seed(VirtMachineState *vms, const char *node)
 {
-    Error *err = NULL;
     uint64_t seed;
 
-    if (qemu_guest_getrandom(&seed, sizeof(seed), &err)) {
-        error_free(err);
+    if (qemu_guest_getrandom(&seed, sizeof(seed), NULL)) {
         return;
     }
     qemu_fdt_setprop_u64(vms->fdt, node, "kaslr-seed", seed);
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index 2689104295..951bcdf2c0 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -1163,16 +1163,14 @@ static void rtas_ibm_configure_connector(PowerPCCPU *cpu,
     drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
 
     if (!drc->fdt) {
-        Error *local_err = NULL;
         void *fdt;
         int fdt_size;
 
         fdt = create_device_tree(&fdt_size);
 
         if (drck->dt_populate(drc, spapr, fdt, &drc->fdt_start_offset,
-                              &local_err)) {
+                              NULL)) {
             g_free(fdt);
-            error_free(local_err);
             rc = SPAPR_DR_CC_RESPONSE_ERROR;
             goto out;
         }
diff --git a/ui/vnc.c b/ui/vnc.c
index 12a12714e1..0702a76cce 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -458,9 +458,8 @@ static VncServerInfo2List *qmp_query_server_entry(QIOChannelSocket *ioc,
     Error *err = NULL;
     SocketAddress *addr;
 
-    addr = qio_channel_socket_get_local_address(ioc, &err);
+    addr = qio_channel_socket_get_local_address(ioc, NULL);
     if (!addr) {
-        error_free(err);
         return prev;
     }
 
-- 
2.26.2



  parent reply	other threads:[~2020-07-02 11:19 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02 11:09 [PULL 00/28] Error reporting patches patches for 2020-07-02 Markus Armbruster
2020-07-02 11:09 ` [PULL 01/28] chardev/tcp: Fix error message double free error Markus Armbruster
2020-07-02 11:09 ` [PULL 02/28] hw/virtio/virtio-iommu-pci.c: Fix typo in error message Markus Armbruster
2020-07-02 11:09 ` [PULL 03/28] net/virtio: Fix failover_replug_primary() return value regression Markus Armbruster
2020-07-02 11:09 ` [PULL 04/28] pci: Delete useless error_propagate() Markus Armbruster
2020-07-02 11:09 ` Markus Armbruster [this message]
2020-07-02 11:09 ` [PULL 06/28] tests: Use &error_abort where appropriate Markus Armbruster
2020-07-02 11:09 ` [PULL 07/28] tests: Use error_free_or_abort() " Markus Armbruster
2020-07-02 11:09 ` [PULL 08/28] usb/dev-mtp: Fix Error double free after inotify failure Markus Armbruster
2020-07-02 11:09 ` [PULL 09/28] spapr: Plug minor memory leak in spapr_machine_init() Markus Armbruster
2020-07-02 11:09 ` [PULL 10/28] qga: Plug unlikely memory leak in guest-set-memory-blocks Markus Armbruster
2020-07-02 11:09 ` [PULL 11/28] sd/milkymist-memcard: Plug minor memory leak in realize Markus Armbruster
2020-07-02 11:09 ` [PULL 12/28] test-util-filemonitor: Plug unlikely memory leak Markus Armbruster
2020-07-02 11:09 ` [PULL 13/28] vnc: Plug minor memory leak in vnc_display_open() Markus Armbruster
2020-07-02 11:09 ` [PULL 14/28] aspeed: Clean up roundabout error propagation Markus Armbruster
2020-07-02 11:09 ` [PULL 15/28] qdev: Drop qbus_set_bus_hotplug_handler() parameter @errp Markus Armbruster
2020-07-02 11:09 ` [PULL 16/28] qdev: Drop qbus_set_hotplug_handler() " Markus Armbruster
2020-07-02 11:09 ` [PULL 17/28] hw: Fix error API violation around object_property_set_link() Markus Armbruster
2020-07-02 11:09 ` [PULL 18/28] hw/arm: Drop useless object_property_set_link() error handling Markus Armbruster
2020-07-02 11:09 ` [PULL 19/28] riscv/sifive_u: Fix sifive_u_soc_realize() error API violations Markus Armbruster
2020-07-02 11:09   ` Markus Armbruster
2020-07-02 11:09 ` [PULL 20/28] riscv_hart: Fix riscv_harts_realize() " Markus Armbruster
2020-07-02 11:09   ` Markus Armbruster
2020-07-02 11:09 ` [PULL 21/28] mips/cps: Fix mips_cps_realize() " Markus Armbruster
2020-07-02 11:09 ` [PULL 22/28] x86: Fix x86_cpu_new() error handling Markus Armbruster
2020-07-02 11:09 ` [PULL 23/28] amd_iommu: Fix amdvi_realize() error API violation Markus Armbruster
2020-07-02 11:09 ` [PULL 24/28] arm/stm32f205 arm/stm32f405: Fix realize " Markus Armbruster
2020-07-02 11:09 ` [PULL 25/28] aspeed: " Markus Armbruster
2020-07-02 11:09 ` [PULL 26/28] hw/arm/armsse: Fix armsse_realize() " Markus Armbruster
2020-07-02 11:09 ` [PULL 27/28] arm/{bcm2835, fsl-imx25, fsl-imx6}: Fix realize error API violations Markus Armbruster
2020-07-02 11:09 ` [PULL 28/28] migration/rdma: Plug memory leaks in qemu_rdma_registration_stop() Markus Armbruster
2020-07-02 16:00 ` [PULL 00/28] Error reporting patches patches for 2020-07-02 Peter Maydell

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=20200702110931.2953148-6-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=groug@kaod.org \
    --cc=jerome@forissier.org \
    --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.