From nobody Wed May 15 11:14:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669021100; cv=none; d=zohomail.com; s=zohoarc; b=GdqqwstW1PfJkEdDzy66E9eAhcrA3wAIMP18wEdh3Ih0DLT/X/BNtbE3uns/39U26l8gIf1z5odx9S1net/qGEtDH3IYGg/lAV7BmSWi2G9qotQhTM34TadK6lSGDnfEa6adTmNIfdsU2yrd97Tny77jL/D3pgwcm1TSW72tJGE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669021100; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7dWlB+cevXfmtboqEY2u1+CahwXrHZ+HTv3/7cTu5jQ=; b=kojyIfr+IF6hJLKi9EjGyNPig02MjNl4c5DO+M3B0Ofc6zfSREkggC7Y5djGZE8i1Yk6/HBOVWXUH2Jw3hgY/chnbXo+NhueytlxMI18LTde3XYMiUu62M3hhxNKqicdU5PwW72t371T3vFdfnW2fvWk0SPjEcCkVuu7LO4SUek= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669021100541972.8682926039255; Mon, 21 Nov 2022 00:58:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox2WM-0003V9-FO; Mon, 21 Nov 2022 03:51:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WJ-0003UO-AD for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WE-00019u-02 for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:15 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-NhsFWf8KOtWXq5Wm1SzZlg-1; Mon, 21 Nov 2022 03:50:58 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E1A85185A7A9; Mon, 21 Nov 2022 08:50:57 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6AF3F2027061; Mon, 21 Nov 2022 08:50:57 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5257421E6930; Mon, 21 Nov 2022 09:50:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669020669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7dWlB+cevXfmtboqEY2u1+CahwXrHZ+HTv3/7cTu5jQ=; b=S/w6zVslolAAribDSG9HnfNI7aPFyMbnYuRWiIhcD8qjinboBrs57Db6JAO4UbGFLPs0o6 uufl3VsyMLJ2hf1iuM9NVXk3MH1Az687iAW2ZbNf6GDnLWpjYA1dJ5LhO2vXb1AyGCOV4U lIqoMehc1a9WGzTSTXNbnkhz4UQgKUs= X-MC-Unique: NhsFWf8KOtWXq5Wm1SzZlg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: eblake@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH 01/10] error: Drop some obviously superfluous error_propagate() Date: Mon, 21 Nov 2022 09:50:45 +0100 Message-Id: <20221121085054.683122-2-armbru@redhat.com> In-Reply-To: <20221121085054.683122-1-armbru@redhat.com> References: <20221121085054.683122-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669021102504100003 Content-Type: text/plain; charset="utf-8" When error_propagate(errp, local_err) is the only reader of @local_err, we can just as well change its writers to write @errp directly, and drop the error_propagate() along with @local_err. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/virt.c | 14 +++++--------- hw/hyperv/vmbus.c | 8 +++----- qga/commands-win32.c | 8 +++----- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index b871350856..02d627a5ab 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2771,24 +2771,20 @@ static void virt_dimm_unplug_request(HotplugHandler= *hotplug_dev, DeviceState *dev, Error **errp) { VirtMachineState *vms =3D VIRT_MACHINE(hotplug_dev); - Error *local_err =3D NULL; =20 if (!vms->acpi_dev) { - error_setg(&local_err, + error_setg(errp, "memory hotplug is not enabled: missing acpi-ged device= "); - goto out; + return; } =20 if (object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM)) { - error_setg(&local_err, - "nvdimm device hot unplug is not supported yet."); - goto out; + error_setg(errp, "nvdimm device hot unplug is not supported yet."); + return; } =20 hotplug_handler_unplug_request(HOTPLUG_HANDLER(vms->acpi_dev), dev, - &local_err); -out: - error_propagate(errp, local_err); + errp); } =20 static void virt_dimm_unplug(HotplugHandler *hotplug_dev, diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c index 30bc04e1c4..5db3fc1192 100644 --- a/hw/hyperv/vmbus.c +++ b/hw/hyperv/vmbus.c @@ -2404,7 +2404,6 @@ static const TypeInfo vmbus_dev_type_info =3D { static void vmbus_realize(BusState *bus, Error **errp) { int ret =3D 0; - Error *local_err =3D NULL; VMBus *vmbus =3D VMBUS(bus); =20 qemu_mutex_init(&vmbus->rx_queue_lock); @@ -2415,13 +2414,13 @@ static void vmbus_realize(BusState *bus, Error **er= rp) ret =3D hyperv_set_msg_handler(VMBUS_MESSAGE_CONNECTION_ID, vmbus_recv_message, vmbus); if (ret !=3D 0) { - error_setg(&local_err, "hyperv set message handler failed: %d", re= t); + error_setg(errp, "hyperv set message handler failed: %d", ret); goto error_out; } =20 ret =3D event_notifier_init(&vmbus->notifier, 0); if (ret !=3D 0) { - error_setg(&local_err, "event notifier failed to init with %d", re= t); + error_setg(errp, "event notifier failed to init with %d", ret); goto remove_msg_handler; } =20 @@ -2429,7 +2428,7 @@ static void vmbus_realize(BusState *bus, Error **errp) ret =3D hyperv_set_event_flag_handler(VMBUS_EVENT_CONNECTION_ID, &vmbus->notifier); if (ret !=3D 0) { - error_setg(&local_err, "hyperv set event handler failed with %d", = ret); + error_setg(errp, "hyperv set event handler failed with %d", ret); goto clear_event_notifier; } =20 @@ -2441,7 +2440,6 @@ remove_msg_handler: hyperv_set_msg_handler(VMBUS_MESSAGE_CONNECTION_ID, NULL, NULL); error_out: qemu_mutex_destroy(&vmbus->rx_queue_lock); - error_propagate(errp, local_err); } =20 static void vmbus_unrealize(BusState *bus) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index ec9f55b453..962db8e543 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -275,13 +275,12 @@ static void acquire_privilege(const char *name, Error= **errp) { HANDLE token =3D NULL; TOKEN_PRIVILEGES priv; - Error *local_err =3D NULL; =20 if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token)) { if (!LookupPrivilegeValue(NULL, name, &priv.Privileges[0].Luid)) { - error_setg(&local_err, QERR_QGA_COMMAND_FAILED, + error_setg(errp, QERR_QGA_COMMAND_FAILED, "no luid for requested privilege"); goto out; } @@ -290,13 +289,13 @@ static void acquire_privilege(const char *name, Error= **errp) priv.Privileges[0].Attributes =3D SE_PRIVILEGE_ENABLED; =20 if (!AdjustTokenPrivileges(token, FALSE, &priv, 0, NULL, 0)) { - error_setg(&local_err, QERR_QGA_COMMAND_FAILED, + error_setg(errp, QERR_QGA_COMMAND_FAILED, "unable to acquire requested privilege"); goto out; } =20 } else { - error_setg(&local_err, QERR_QGA_COMMAND_FAILED, + error_setg(errp, QERR_QGA_COMMAND_FAILED, "failed to open privilege token"); } =20 @@ -304,7 +303,6 @@ out: if (token) { CloseHandle(token); } - error_propagate(errp, local_err); } =20 static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque, --=20 2.37.3 From nobody Wed May 15 11:14:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669020766; cv=none; d=zohomail.com; s=zohoarc; b=Bim0cIRlT7juOFWl+kA8MXMN8QbEK9dTkZJJEmW1F+pYRozF8U1wyBAzW/dTTXyc0aWc//AgJsJ44HHAjD2kBbYxL2kc5QfLikhzFUtC46uihTzC7FHlbo37RcLfLdSxsBvmq5guD9ojNHm9iGv4eBDlU/HLgaMVnKy6R09AlG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669020766; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LRR3uqin+VUUqM+bopGoHdqTXDCi2exrmc0fzxeuZPM=; b=mgKHip1v6BHcIhnNgu+memKkaJtYV38OzRiJt8vaBYJ7qYt2ZTe1USuYSpw+ui1ZN/7IwlNNnR1gc1Q7FKLqTawmUS/QCm3su9QljB3FFXYzb/cG0K5cH+utlBE8OAamCnlgncHn/d2LchxLRt5Icnb3XYrT+gLQq3JpXdrpglA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669020766476501.4809342651853; Mon, 21 Nov 2022 00:52:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox2WF-0003SF-5d; Mon, 21 Nov 2022 03:51:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WD-0003Rf-Gz for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2W6-000182-G9 for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:09 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-176-YuJNaLhvM9eepU58Z2G4CA-1; Mon, 21 Nov 2022 03:50:58 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C38591C0755F; Mon, 21 Nov 2022 08:50:57 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6AE2F492B06; Mon, 21 Nov 2022 08:50:57 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 54BDE21E6936; Mon, 21 Nov 2022 09:50:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669020661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LRR3uqin+VUUqM+bopGoHdqTXDCi2exrmc0fzxeuZPM=; b=SsLfGhrDPwCMpv78KaMXJ9wxBM/hbLDikstecZSL/dfm8yx1ta7GnEZZXMIS/uglL5swco Fd4KCTUjuDut71uGYBIcWODPYCYBCLOyaC17FRqyfpudXmZeZwtG5KrucUATK+7VePLuFW L3wCX2AsklA8BAmBviSYb4Eps12AFow= X-MC-Unique: YuJNaLhvM9eepU58Z2G4CA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: eblake@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH 02/10] error: Drop a few superfluous ERRP_GUARD() Date: Mon, 21 Nov 2022 09:50:46 +0100 Message-Id: <20221121085054.683122-3-armbru@redhat.com> In-Reply-To: <20221121085054.683122-1-armbru@redhat.com> References: <20221121085054.683122-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669020767921100001 Content-Type: text/plain; charset="utf-8" include/qapi/error.h on ERRP_GUARD(): * It must be used when the function dereferences @errp or passes * @errp to error_prepend(), error_vprepend(), or error_append_hint(). * It is safe to use even when it's not needed, but please avoid * cluttering the source with useless code. Clean up some of this clutter. Signed-off-by: Markus Armbruster --- block/copy-before-write.c | 1 - dump/dump.c | 2 -- hw/core/qdev.c | 2 -- hw/pci/msi.c | 1 - hw/remote/vfio-user-obj.c | 1 - ui/util.c | 1 - 6 files changed, 8 deletions(-) diff --git a/block/copy-before-write.c b/block/copy-before-write.c index 4abaa7339e..6f0157244f 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -522,7 +522,6 @@ BlockDriverState *bdrv_cbw_append(BlockDriverState *sou= rce, BlockCopyState **bcs, Error **errp) { - ERRP_GUARD(); BDRVCopyBeforeWriteState *state; BlockDriverState *top; QDict *opts; diff --git a/dump/dump.c b/dump/dump.c index df117c847f..c9afc30ce2 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -357,7 +357,6 @@ static void write_elf32_notes(WriteCoreDumpFunction f, = DumpState *s, =20 static void write_elf_phdr_note(DumpState *s, Error **errp) { - ERRP_GUARD(); Elf32_Phdr phdr32; Elf64_Phdr phdr64; void *phdr; @@ -773,7 +772,6 @@ static void dump_iterate(DumpState *s, Error **errp) static void dump_end(DumpState *s, Error **errp) { int rc; - ERRP_GUARD(); =20 if (s->elf_section_data_size) { s->elf_section_data =3D g_malloc0(s->elf_section_data_size); diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 0145501904..67be2feaf3 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -493,8 +493,6 @@ void qdev_del_unplug_blocker(DeviceState *dev, Error *r= eason) =20 bool qdev_unplug_blocked(DeviceState *dev, Error **errp) { - ERRP_GUARD(); - if (dev->unplug_blockers) { error_propagate(errp, error_copy(dev->unplug_blockers->data)); return true; diff --git a/hw/pci/msi.c b/hw/pci/msi.c index 058d1d1ef1..1cadf150bc 100644 --- a/hw/pci/msi.c +++ b/hw/pci/msi.c @@ -317,7 +317,6 @@ bool msi_is_masked(const PCIDevice *dev, unsigned int v= ector) =20 void msi_set_mask(PCIDevice *dev, int vector, bool mask, Error **errp) { - ERRP_GUARD(); uint16_t flags =3D pci_get_word(dev->config + msi_flags_off(dev)); bool msi64bit =3D flags & PCI_MSI_FLAGS_64BIT; uint32_t irq_state, vector_mask, pending; diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c index 4e36bb8bcf..6d0310cec9 100644 --- a/hw/remote/vfio-user-obj.c +++ b/hw/remote/vfio-user-obj.c @@ -719,7 +719,6 @@ static void vfu_object_machine_done(Notifier *notifier,= void *data) */ static void vfu_object_init_ctx(VfuObject *o, Error **errp) { - ERRP_GUARD(); DeviceState *dev =3D NULL; vfu_pci_type_t pci_type =3D VFU_PCI_TYPE_CONVENTIONAL; int ret; diff --git a/ui/util.c b/ui/util.c index 7e8fc1ea53..907d60e032 100644 --- a/ui/util.c +++ b/ui/util.c @@ -51,7 +51,6 @@ bool qemu_console_fill_device_address(QemuConsole *con, size_t size, Error **errp) { - ERRP_GUARD(); DeviceState *dev =3D DEVICE(object_property_get_link(OBJECT(con), "device", &error_abort)); --=20 2.37.3 From nobody Wed May 15 11:14:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669020713; cv=none; d=zohomail.com; s=zohoarc; b=cQrqYWxMgRCJnq4lSjdFjonzq2zu3QZByFaDhWEwNhbStVJwBIjiw32hIiwStjdkvmoVhaiZk1xSWCYplF2SlSQgLHIjf6jGaBhsLxJZGg6UhaQn7NQNEdaFFB+j+rAyePzLTcQvUXtxsSQCF7e7Yz7NGErAHi4quqwATUYGvuE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669020713; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jDv0ubaO+N3LMzdZmT55EuBNu1HAwtE3h3isB/TzhZY=; b=Vt8wcW4mCxaXMlK3DzyiuBilkkOtcnSG5YtvaVsJIiGBvBkxzgQHUtGsQvRN3W3ylJlDgT1WYtBjcLU/DmD1ur3Pv1IUAK9b1PazY4dmb2/Ej7xJ7ErmhBQ2mLhp+G3ethCYhlQEBDHvGTVrx79yHF9SSJzKA02PNHvLCaxq3IU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669020713396408.23211214415164; Mon, 21 Nov 2022 00:51:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox2WB-0003Qx-Ad; Mon, 21 Nov 2022 03:51:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WA-0003Qh-E6 for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2W5-00017l-L9 for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:06 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-226-RUkhXadZMnqIy_ev9wENFg-1; Mon, 21 Nov 2022 03:50:58 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C469D2A2AD77; Mon, 21 Nov 2022 08:50:57 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6AEB740C6EC2; Mon, 21 Nov 2022 08:50:57 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5751B21E688F; Mon, 21 Nov 2022 09:50:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669020660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jDv0ubaO+N3LMzdZmT55EuBNu1HAwtE3h3isB/TzhZY=; b=V3nhDagiiqFN5gn6MZqsqswELCjOrRf5M1/yBVm6/QRRBxvIEShWFjA0GdNg3OgoD7I1aT rc6zQkkaJpWbdbdor4JuywT7PHf14fqoCG8BF5rudM2akjlYhnHlpwBhyXRk5bxzAxCUyB IXYppNUciKi7MkCydu7ZT1cvLH1vNZs= X-MC-Unique: RUkhXadZMnqIy_ev9wENFg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: eblake@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH 03/10] error: Move ERRP_GUARD() to the beginning of the function Date: Mon, 21 Nov 2022 09:50:47 +0100 Message-Id: <20221121085054.683122-4-armbru@redhat.com> In-Reply-To: <20221121085054.683122-1-armbru@redhat.com> References: <20221121085054.683122-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669020714239100003 Content-Type: text/plain; charset="utf-8" include/qapi/error.h advises to put ERRP_GUARD() right at the beginning of the function, because only then can it guard the whole function. Clean up the few spots disregarding the advice. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/armsse.c | 3 +-- hw/core/machine.c | 3 +-- hw/virtio/vhost-vdpa.c | 2 +- iothread.c | 2 +- monitor/qmp-cmds.c | 4 ++-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index aecdeb9815..0202bad787 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -900,6 +900,7 @@ static qemu_irq armsse_get_common_irq_in(ARMSSE *s, int= irqno) =20 static void armsse_realize(DeviceState *dev, Error **errp) { + ERRP_GUARD(); ARMSSE *s =3D ARM_SSE(dev); ARMSSEClass *asc =3D ARM_SSE_GET_CLASS(dev); const ARMSSEInfo *info =3D asc->info; @@ -914,8 +915,6 @@ static void armsse_realize(DeviceState *dev, Error **er= rp) DeviceState *dev_splitter; uint32_t addr_width_max; =20 - ERRP_GUARD(); - if (!s->board_memory) { error_setg(errp, "memory property was not set"); return; diff --git a/hw/core/machine.c b/hw/core/machine.c index 8d34caa31d..2352861240 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -554,12 +554,11 @@ static void machine_get_mem(Object *obj, Visitor *v, = const char *name, static void machine_set_mem(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { + ERRP_GUARD(); MachineState *ms =3D MACHINE(obj); MachineClass *mc =3D MACHINE_GET_CLASS(obj); MemorySizeConfiguration *mem; =20 - ERRP_GUARD(); - if (!visit_type_MemorySizeConfiguration(v, name, &mem, errp)) { return; } diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 7468e44b87..bc1c79b325 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -963,6 +963,7 @@ static bool vhost_vdpa_svq_map_rings(struct vhost_dev *= dev, struct vhost_vring_addr *addr, Error **errp) { + ERRP_GUARD(); DMAMap device_region, driver_region; struct vhost_vring_addr svq_addr; struct vhost_vdpa *v =3D dev->opaque; @@ -971,7 +972,6 @@ static bool vhost_vdpa_svq_map_rings(struct vhost_dev *= dev, size_t avail_offset; bool ok; =20 - ERRP_GUARD(); vhost_svq_get_vring_addr(svq, &svq_addr); =20 driver_region =3D (DMAMap) { diff --git a/iothread.c b/iothread.c index 529194a566..3862a64471 100644 --- a/iothread.c +++ b/iothread.c @@ -155,8 +155,8 @@ static void iothread_init_gcontext(IOThread *iothread) =20 static void iothread_set_aio_context_params(EventLoopBase *base, Error **e= rrp) { - IOThread *iothread =3D IOTHREAD(base); ERRP_GUARD(); + IOThread *iothread =3D IOTHREAD(base); =20 if (!iothread->ctx) { return; diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 81c8fdadf8..686d562cad 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -474,9 +474,9 @@ static bool invoke_stats_cb(StatsCallbacks *entry, StatsFilter *filter, StatsRequest *request, Error **errp) { + ERRP_GUARD(); strList *targets =3D NULL; strList *names =3D NULL; - ERRP_GUARD(); =20 if (request) { if (request->provider !=3D entry->provider) { @@ -541,9 +541,9 @@ StatsSchemaList *qmp_query_stats_schemas(bool has_provi= der, StatsProvider provider, Error **errp) { + ERRP_GUARD(); StatsSchemaList *stats_results =3D NULL; StatsCallbacks *entry; - ERRP_GUARD(); =20 QTAILQ_FOREACH(entry, &stats_callbacks, next) { if (!has_provider || provider =3D=3D entry->provider) { --=20 2.37.3 From nobody Wed May 15 11:14:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669020806; cv=none; d=zohomail.com; s=zohoarc; b=HzmI0dP6L7YeLcEipI022YVjTrNs4vWpcLdQTNXUaMzjS9T2k2+45H3gqxju21DTqLxoMscTEEY573WMXizxOq63roCCtd0OIt/KYn1+/yaVFzczanOMkZAtXdsrPLQMy2PqfZcl3KotQjGT66zuFO12ojbt4ZCGPQzyJkEh0aw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669020806; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Up+QvkqicLsYw24nwgOZ1rYw4IwHaA+47npc0C+bRLI=; b=l+p/lsaDCK0L6to83NjcIgOgwdVhWs//P+uktHQrA235ERZ1uYYS8OaGBm/clutkasQF+1Z2pLu7enYq0QjZvsKOD/6wx9VnCBVIKe2WgBw68BCfXTPw9UzqBuqRfE12MJpjI7k04t+IqSGhcA6XV3gljp630pXpLwJe/bRWUFw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669020806417199.45491799941033; Mon, 21 Nov 2022 00:53:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox2WD-0003Rb-4x; Mon, 21 Nov 2022 03:51:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WA-0003Qp-R6 for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2W6-000187-G8 for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:06 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-226-wPp6GiQ9OrKGOan6ygFv8g-1; Mon, 21 Nov 2022 03:50:58 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C3DE93814940; Mon, 21 Nov 2022 08:50:57 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6AE9117595; Mon, 21 Nov 2022 08:50:57 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5A13121E66CA; Mon, 21 Nov 2022 09:50:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669020662; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Up+QvkqicLsYw24nwgOZ1rYw4IwHaA+47npc0C+bRLI=; b=OnqLRhGaV0vnhlYx9r7v1LkfOyzTUQaZql1mCD+1aE6JryRI5yqEdroXG2LZvgNv55qisp voc1F9dcaIB7rS2nG5KvPYE3fyD5faCDpTka5EZivkZ5Vyptbd9rFHiQuC5Mee/7OzgXLM kf7afRzXDvTUHldt8RQRJ0rT5cEsXvQ= X-MC-Unique: wPp6GiQ9OrKGOan6ygFv8g-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: eblake@redhat.com, vsementsov@yandex-team.ru, "Dr . David Alan Gilbert" Subject: [PATCH 04/10] monitor: Simplify monitor_fd_param()'s error handling Date: Mon, 21 Nov 2022 09:50:48 +0100 Message-Id: <20221121085054.683122-5-armbru@redhat.com> In-Reply-To: <20221121085054.683122-1-armbru@redhat.com> References: <20221121085054.683122-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669020808060100003 Content-Type: text/plain; charset="utf-8" Cc: Dr. David Alan Gilbert Signed-off-by: Markus Armbruster --- monitor/misc.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/monitor/misc.c b/monitor/misc.c index 205487e2b9..83d7f4ffde 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -1086,6 +1086,7 @@ int monitor_get_fd(Monitor *mon, const char *fdname, = Error **errp) } =20 fd =3D monfd->fd; + assert(fd >=3D 0); =20 /* caller takes ownership of fd */ QLIST_REMOVE(monfd, next); @@ -1403,23 +1404,16 @@ void monitor_fdset_dup_fd_remove(int dup_fd) int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp) { int fd; - Error *local_err =3D NULL; =20 if (!qemu_isdigit(fdname[0]) && mon) { - fd =3D monitor_get_fd(mon, fdname, &local_err); + fd =3D monitor_get_fd(mon, fdname, errp); } else { fd =3D qemu_parse_fd(fdname); - if (fd =3D=3D -1) { - error_setg(&local_err, "Invalid file descriptor number '%s'", + if (fd < 0) { + error_setg(errp, "Invalid file descriptor number '%s'", fdname); } } - if (local_err) { - error_propagate(errp, local_err); - assert(fd =3D=3D -1); - } else { - assert(fd !=3D -1); - } =20 return fd; } --=20 2.37.3 From nobody Wed May 15 11:14:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669020998; cv=none; d=zohomail.com; s=zohoarc; b=HGIxq/WpYXWGWGvkcZX4AjF79UdadFzXyXZNvwToS3g0wc2V7fENueHKGk70dbZJ9L5BjhiRboDf2u3fgFlCUECYrZalaRfY2eipU70Q1T7dKxqVAVNeHfRBI9GmWSSX7bZPMrothsuJGqGokc44ZvGZCFInHML9J0rjzwMHfu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669020998; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BPThqbOxaLvUyLAUAkc5zA6NDoxmD2W8EmnCeHvRUyE=; b=T1EYxgY8B/eyDFkjuQVcUUJAtTkA8u1yQXjOtAUH9Mb+zUUfkvXelZANZuZlZwX3/LPNXxAxk7MFCLMgDZsoxFFgbRaKuMbH4ijVfAzrU7ZgZs9zN5irxmBItjobJOEJxR8e8D8+SQ+KyNUpXST0+2iszjL9WMTdS98SH0uinNw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669020998769415.63051085184236; Mon, 21 Nov 2022 00:56:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox2WI-0003U2-7w; Mon, 21 Nov 2022 03:51:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WG-0003TC-S8 for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WF-0001AJ-3G for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:12 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-526-DDqYQCVgP-S5tC8-sqvpdA-1; Mon, 21 Nov 2022 03:51:01 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E38B41C07552; Mon, 21 Nov 2022 08:51:00 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C00FE4EA4E; Mon, 21 Nov 2022 08:51:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5C52C21E66CD; Mon, 21 Nov 2022 09:50:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669020670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BPThqbOxaLvUyLAUAkc5zA6NDoxmD2W8EmnCeHvRUyE=; b=EH4I9QqsNTNp0TuJExS/L2K/Ig+7dCYhJuMTWl0BsfLF2DTAj2A51AicBEHa/ZHeWHzhiH 9TGK2IK3qje4kcnxFllXlrTv/EIA2dKDSs2sDAyPqnVjig2ZiZGmhKICTJsRuTpvadH/Pm IqtG3o8S7pMJzD5N42k/QCgMNEQXhEk= X-MC-Unique: DDqYQCVgP-S5tC8-sqvpdA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: eblake@redhat.com, vsementsov@yandex-team.ru, "Dr . David Alan Gilbert" Subject: [PATCH 05/10] monitor: Use ERRP_GUARD() in monitor_init() Date: Mon, 21 Nov 2022 09:50:49 +0100 Message-Id: <20221121085054.683122-6-armbru@redhat.com> In-Reply-To: <20221121085054.683122-1-armbru@redhat.com> References: <20221121085054.683122-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669020999261100001 Content-Type: text/plain; charset="utf-8" Cc: Dr. David Alan Gilbert Signed-off-by: Markus Armbruster --- monitor/monitor.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/monitor/monitor.c b/monitor/monitor.c index 86949024f6..7ed7bd5342 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -711,8 +711,8 @@ void monitor_init_globals_core(void) =20 int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp) { + ERRP_GUARD(); Chardev *chr; - Error *local_err =3D NULL; =20 chr =3D qemu_chr_find(opts->chardev); if (chr =3D=3D NULL) { @@ -726,7 +726,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, = Error **errp) =20 switch (opts->mode) { case MONITOR_MODE_CONTROL: - monitor_init_qmp(chr, opts->pretty, &local_err); + monitor_init_qmp(chr, opts->pretty, errp); break; case MONITOR_MODE_READLINE: if (!allow_hmp) { @@ -737,17 +737,13 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp= , Error **errp) error_setg(errp, "'pretty' is not compatible with HMP monitors= "); return -1; } - monitor_init_hmp(chr, true, &local_err); + monitor_init_hmp(chr, true, errp); break; default: g_assert_not_reached(); } =20 - if (local_err) { - error_propagate(errp, local_err); - return -1; - } - return 0; + return *errp ? -1 : 0; } =20 int monitor_init_opts(QemuOpts *opts, Error **errp) --=20 2.37.3 From nobody Wed May 15 11:14:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669020772; cv=none; d=zohomail.com; s=zohoarc; b=fhYm/NOpJBlAEp+YL0L0vksdNaeUr+XEy2JQLmyMH3YKXMm0r+QSLRJVFcTDgpEx2kUoY9LZop9TSwFbC6+6AT74HMqJrEhd72sInHc0Rpx4/MxP6ucAeYMJH6/p17PZ9+JfAShTyV8ukQrQwc93jRAFnfu1PCFsMIVD3wDGI4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669020772; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DCaakuTL7O4pqVMJO91mcT//ImpjFr/NZlUtbevgnN8=; b=ZoAyWXPj5YNdX6GQ4TzF7DiBaUaoibw5sKhqyN/UNYr7LUPjygO3jqfjsb+qveSdtgDheC49DjYHM9feeuO7BXskpOeU7RhDVALEMV6rmzrw8CorNBarE2KGHhxLmtX1QzIV8ujzHdqTW4fRNh0uakURPq5qnewjbhBZ5J2aw6o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16690207725871009.3140189030249; Mon, 21 Nov 2022 00:52:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox2WM-0003V7-8O; Mon, 21 Nov 2022 03:51:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WF-0003Sa-Bw for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2W8-00018U-36 for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:10 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-21-8ZLXFQPdOuGocfBvRWkJ2w-1; Mon, 21 Nov 2022 03:51:01 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D2E53C0DDB3; Mon, 21 Nov 2022 08:51:01 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFFC02166B26; Mon, 21 Nov 2022 08:51:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5EA6B21E66F3; Mon, 21 Nov 2022 09:50:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669020663; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DCaakuTL7O4pqVMJO91mcT//ImpjFr/NZlUtbevgnN8=; b=FPeb+d92POBTOHRfFocq717Xrq00bIUwtYrTxac7iDAxCXr/5zvKVaNERKWntzbqOeAKQp ZqFJtF6Z5UJJ00PsIpkpVugcI97rvPAUP2Rc7ti0oaExCRNSVqYYKGim4HZY7H9mEPrD5+ PDszgkcWREB8esiFw7SyDJDxxdx37qY= X-MC-Unique: 8ZLXFQPdOuGocfBvRWkJ2w-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: eblake@redhat.com, vsementsov@yandex-team.ru, Hanna Reitz Subject: [PATCH 06/10] qemu-config: Make config_parse_qdict() return bool Date: Mon, 21 Nov 2022 09:50:50 +0100 Message-Id: <20221121085054.683122-7-armbru@redhat.com> In-Reply-To: <20221121085054.683122-1-armbru@redhat.com> References: <20221121085054.683122-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669020773922100001 Content-Type: text/plain; charset="utf-8" This simplifies error checking. Cc: Hanna Reitz Signed-off-by: Markus Armbruster --- include/qemu/config-file.h | 2 +- block/blkdebug.c | 4 +--- util/qemu-config.c | 39 ++++++++++++++++++-------------------- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h index 321e7c7c03..b82a778123 100644 --- a/include/qemu/config-file.h +++ b/include/qemu/config-file.h @@ -22,7 +22,7 @@ int qemu_read_config_file(const char *filename, QEMUConfi= gCB *f, Error **errp); =20 /* Parse QDict options as a replacement for a config file (allowing multip= le enumerated (0..(n-1)) configuration "sections") */ -void qemu_config_parse_qdict(QDict *options, QemuOptsList **lists, +bool qemu_config_parse_qdict(QDict *options, QemuOptsList **lists, Error **errp); =20 #endif /* QEMU_CONFIG_FILE_H */ diff --git a/block/blkdebug.c b/block/blkdebug.c index 4265ca125e..ca65b043f0 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -297,9 +297,7 @@ static int read_config(BDRVBlkdebugState *s, const char= *filename, } } =20 - qemu_config_parse_qdict(options, config_groups, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!qemu_config_parse_qdict(options, config_groups, errp)) { ret =3D -EINVAL; goto fail; } diff --git a/util/qemu-config.c b/util/qemu-config.c index 433488aa56..e983607b46 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -423,12 +423,12 @@ int qemu_read_config_file(const char *filename, QEMUC= onfigCB *cb, Error **errp) return ret; } =20 -static void config_parse_qdict_section(QDict *options, QemuOptsList *opts, +static bool config_parse_qdict_section(QDict *options, QemuOptsList *opts, Error **errp) { QemuOpts *subopts; - QDict *subqdict; - QList *list =3D NULL; + g_autoptr(QDict) subqdict =3D NULL; + g_autoptr(QList) list =3D NULL; size_t orig_size, enum_size; char *prefix; =20 @@ -437,23 +437,23 @@ static void config_parse_qdict_section(QDict *options= , QemuOptsList *opts, g_free(prefix); orig_size =3D qdict_size(subqdict); if (!orig_size) { - goto out; + return true; } =20 subopts =3D qemu_opts_create(opts, NULL, 0, errp); if (!subopts) { - goto out; + return false; } =20 if (!qemu_opts_absorb_qdict(subopts, subqdict, errp)) { - goto out; + return false; } =20 enum_size =3D qdict_size(subqdict); if (enum_size < orig_size && enum_size) { error_setg(errp, "Unknown option '%s' for [%s]", qdict_first(subqdict)->key, opts->name); - goto out; + return false; } =20 if (enum_size) { @@ -468,7 +468,7 @@ static void config_parse_qdict_section(QDict *options, = QemuOptsList *opts, if (qdict_size(subqdict)) { error_setg(errp, "Unused option '%s' for [%s]", qdict_first(subqdict)->key, opts->name); - goto out; + return false; } =20 QLIST_FOREACH_ENTRY(list, list_entry) { @@ -478,46 +478,43 @@ static void config_parse_qdict_section(QDict *options= , QemuOptsList *opts, if (!section) { error_setg(errp, "[%s] section (index %u) does not consist= of " "keys", opts->name, i); - goto out; + return false; } =20 opt_name =3D g_strdup_printf("%s.%u", opts->name, i++); subopts =3D qemu_opts_create(opts, opt_name, 1, errp); g_free(opt_name); if (!subopts) { - goto out; + return false; } =20 if (!qemu_opts_absorb_qdict(subopts, section, errp)) { qemu_opts_del(subopts); - goto out; + return false; } =20 if (qdict_size(section)) { error_setg(errp, "[%s] section doesn't support the option = '%s'", opts->name, qdict_first(section)->key); qemu_opts_del(subopts); - goto out; + return false; } } } =20 -out: - qobject_unref(subqdict); - qobject_unref(list); + return true; } =20 -void qemu_config_parse_qdict(QDict *options, QemuOptsList **lists, +bool qemu_config_parse_qdict(QDict *options, QemuOptsList **lists, Error **errp) { int i; - Error *local_err =3D NULL; =20 for (i =3D 0; lists[i]; i++) { - config_parse_qdict_section(options, lists[i], &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; + if (!config_parse_qdict_section(options, lists[i], errp)) { + return false; } } + + return true; } --=20 2.37.3 From nobody Wed May 15 11:14:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669020911; cv=none; d=zohomail.com; s=zohoarc; b=M0Pb2f+PVuJdENpCl4EP/OM9+66bECFsst82/qyHu4RDI2PxfmWoP4GxF4iz0WutBqo7b1/DgLZLIbKfizZ6I8evjISl3HlJV9oCQrej69kH3GzsJOyXaA0LXfogTChDiBWZNN+soWgk6fW7O1gb2dLUx/pWMxgG4xI2FrN/jzs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669020911; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+aiIidnJhvNUHF76/U3S+18BlPO7cg2BAPDF2EnkQ7w=; b=ZyiTlUYov5qSAaXzAjYXIKz4azG+uiGrBDcEYifudeh7D80wNlPSv9zcyadzz1+aubnKOPSCjL7VOSo6WTq1M8XL27fQmuFGwicIeFJI2HRc+DOTvFMQWAGme+oEjLoMvirfxLcDF+9VQmYLeFucthqE7oaCyajz+SClBKD+WUA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669020911823154.10886934472217; Mon, 21 Nov 2022 00:55:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox2WG-0003T8-Ew; Mon, 21 Nov 2022 03:51:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WF-0003SY-B7 for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WD-00019i-ID for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:10 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-339-UVFXL3B7PPavb-YGIngTvw-1; Mon, 21 Nov 2022 03:51:01 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E1AEE185A78F; Mon, 21 Nov 2022 08:51:00 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF6B04EA4A; Mon, 21 Nov 2022 08:51:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 60DC521E66F5; Mon, 21 Nov 2022 09:50:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669020668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+aiIidnJhvNUHF76/U3S+18BlPO7cg2BAPDF2EnkQ7w=; b=Vjgq8bBDYYedHDLBJxT0jk3qZzwwlXMQ2j6pDtrKkkLI1MyzL2WURBZazi2oxY9LdqHh5z M96nClTuY50bRYK8cjJym3kkL/lJawxS/C4dz/3F8ds85moLotr5+i23QL36/IKpMDgRDy tbUXI3ukcjnIb0r5OS9EIQjIpsFn0t0= X-MC-Unique: UVFXL3B7PPavb-YGIngTvw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: eblake@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH 07/10] qemu-config: Use ERRP_GUARD() where obviously appropriate Date: Mon, 21 Nov 2022 09:50:51 +0100 Message-Id: <20221121085054.683122-8-armbru@redhat.com> In-Reply-To: <20221121085054.683122-1-armbru@redhat.com> References: <20221121085054.683122-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669020912603100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster --- util/qemu-config.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/util/qemu-config.c b/util/qemu-config.c index e983607b46..8c907fa83b 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -318,9 +318,9 @@ void qemu_add_opts(QemuOptsList *list) static int qemu_config_foreach(FILE *fp, QEMUConfigCB *cb, void *opaque, const char *fname, Error **errp) { + ERRP_GUARD(); char line[1024], prev_group[64], group[64], arg[64], value[1024]; Location loc; - Error *local_err =3D NULL; QDict *qdict =3D NULL; int res =3D -EINVAL, lno =3D 0; int count =3D 0; @@ -348,10 +348,9 @@ static int qemu_config_foreach(FILE *fp, QEMUConfigCB = *cb, void *opaque, } if (qdict !=3D prev) { if (prev) { - cb(prev_group, prev, opaque, &local_err); + cb(prev_group, prev, opaque, errp); qobject_unref(prev); - if (local_err) { - error_propagate(errp, local_err); + if (*errp) { goto out; } } --=20 2.37.3 From nobody Wed May 15 11:14:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669020757; cv=none; d=zohomail.com; s=zohoarc; b=Rc8LD6KrsJxfSO/Bew0lC58phwjKoX7whhi1y3KfU/vtTnVF48J8WjQYAQBI1yhelNKBeT5c/oA0zTq4tqx6q9e25bVnqeMZluNn5Xf3BLmZU4wE8dIbcStnlPVJE+0PxqRTeOu6hCv/HgzvL6jqqX0wtpa4f76y8HYXBYHcEDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669020757; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bT4LKlTlWOK0FhC8/IHmyYDWCV9pXXCqCFGyR+rQjZ8=; b=fDXHWhfC5642cJICNrhWhUbqdd8XKLdSGnCp2+lpq4ohEwrx999P8wCWZqPlPJB72B61jfD5vbOwLQCRPfdpuAKvQzYfMDWv8jJczpMIDIVUaOFhGm7N5+JMpuu3XAHKCq0W7JOSVQJUaDjm+gvuRLm5KQFVRrWDo+QK9BWf+fg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669020757293387.8054888481752; Mon, 21 Nov 2022 00:52:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox2WD-0003Rz-VT; Mon, 21 Nov 2022 03:51:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WC-0003RE-Ip for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WA-00018u-2Y for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:07 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-339-oKLJT87sMWynqu50sFYINw-1; Mon, 21 Nov 2022 03:51:01 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E39B4185A792; Mon, 21 Nov 2022 08:51:00 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFEB3492B06; Mon, 21 Nov 2022 08:51:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 631AC21E66FD; Mon, 21 Nov 2022 09:50:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669020665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bT4LKlTlWOK0FhC8/IHmyYDWCV9pXXCqCFGyR+rQjZ8=; b=Hl5zMjk3ZJc2G1VX1bvnDPGnbKBMouW0wN7qvxEaNLqkIKg0lSVyb8LU4QuADMM/bnRN7g hxGJkJtV9gtVqQmKKbC0o3qgoApMPk4c6HTrk/yLmypCqaWD+Y/EK5qu3awmfpct7Xok1Z gQr4TPQA8t/hEtaMF2E5/Yw+yZHfJLQ= X-MC-Unique: oKLJT87sMWynqu50sFYINw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: eblake@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH 08/10] sockets: Use ERRP_GUARD() where obviously appropriate Date: Mon, 21 Nov 2022 09:50:52 +0100 Message-Id: <20221121085054.683122-9-armbru@redhat.com> In-Reply-To: <20221121085054.683122-1-armbru@redhat.com> References: <20221121085054.683122-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669020757871100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster --- util/qemu-sockets.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index d185245023..6538859b87 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -210,7 +210,8 @@ static int inet_listen_saddr(InetSocketAddress *saddr, int num, Error **errp) { - struct addrinfo ai,*res,*e; + ERRP_GUARD(); + struct addrinfo ai, *res, *e; char port[33]; char uaddr[INET6_ADDRSTRLEN+1]; char uport[33]; @@ -218,7 +219,6 @@ static int inet_listen_saddr(InetSocketAddress *saddr, int slisten =3D -1; int saved_errno =3D 0; bool socket_created =3D false; - Error *err =3D NULL; =20 if (saddr->keep_alive) { error_setg(errp, "keep-alive option is not supported for passive " @@ -231,11 +231,9 @@ static int inet_listen_saddr(InetSocketAddress *saddr, if (saddr->has_numeric && saddr->numeric) { ai.ai_flags |=3D AI_NUMERICHOST | AI_NUMERICSERV; } - ai.ai_family =3D inet_ai_family_from_address(saddr, &err); ai.ai_socktype =3D SOCK_STREAM; - - if (err) { - error_propagate(errp, err); + ai.ai_family =3D inet_ai_family_from_address(saddr, errp); + if (*errp) { return -1; } =20 @@ -392,9 +390,9 @@ static int inet_connect_addr(const InetSocketAddress *s= addr, static struct addrinfo *inet_parse_connect_saddr(InetSocketAddress *saddr, Error **errp) { + ERRP_GUARD(); struct addrinfo ai, *res; int rc; - Error *err =3D NULL; static int useV4Mapped =3D 1; =20 memset(&ai, 0, sizeof(ai)); @@ -403,11 +401,9 @@ static struct addrinfo *inet_parse_connect_saddr(InetS= ocketAddress *saddr, if (qatomic_read(&useV4Mapped)) { ai.ai_flags |=3D AI_V4MAPPED; } - ai.ai_family =3D inet_ai_family_from_address(saddr, &err); ai.ai_socktype =3D SOCK_STREAM; - - if (err) { - error_propagate(errp, err); + ai.ai_family =3D inet_ai_family_from_address(saddr, errp); + if (*errp) { return NULL; } =20 @@ -499,20 +495,18 @@ static int inet_dgram_saddr(InetSocketAddress *sraddr, InetSocketAddress *sladdr, Error **errp) { + ERRP_GUARD(); struct addrinfo ai, *peer =3D NULL, *local =3D NULL; const char *addr; const char *port; int sock =3D -1, rc; - Error *err =3D NULL; =20 /* lookup peer addr */ memset(&ai,0, sizeof(ai)); ai.ai_flags =3D AI_CANONNAME | AI_V4MAPPED | AI_ADDRCONFIG; - ai.ai_family =3D inet_ai_family_from_address(sraddr, &err); ai.ai_socktype =3D SOCK_DGRAM; - - if (err) { - error_propagate(errp, err); + ai.ai_family =3D inet_ai_family_from_address(sraddr, errp); + if (*errp) { goto err; } =20 --=20 2.37.3 From nobody Wed May 15 11:14:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669020736; cv=none; d=zohomail.com; s=zohoarc; b=S3McMykV1nrAYSdjIcw9N0m3GoJWmgAObdCVg6WZJRaFlDYgdBZ0zCYD49ux8ARG03E3/KtrIOSi5+JcEk24olhgPD/oWb/TBDmrTLx4MRTVrICrqEzl87qW8RoOFj58fFAmQpQ6NHEJ11Oe8PzVUXgmBEsRQJsQGS8Yb7227YQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669020736; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ajs0bZcH95LXKj1Rclh6Teto9EWPgTTXw2RkvgSFeTA=; b=dE2OLJgygbi9McZy5WAyJ2V84r6ZIrwMhhN+HRQiq/ibYSOByr2403sl6WyzGTiSrnb9XX4XzL6uopX+WnW+14kl1HX/puPmLPti6v2lNZHUkU53D2s/EJBKeKqm/zkcnt5kmMdoaa6ld3Wz4z23M5CareZdg+HvTZf1jKJbd38= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669020736103675.8291716600125; Mon, 21 Nov 2022 00:52:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox2WF-0003T4-St; Mon, 21 Nov 2022 03:51:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WE-0003Ry-3b for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WA-00018w-2l for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:09 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-369-qJ3SIDp8OreIcgq_GLHHvA-1; Mon, 21 Nov 2022 03:51:01 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0EF7D811E7A; Mon, 21 Nov 2022 08:51:01 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C065F40C213F; Mon, 21 Nov 2022 08:51:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 653C121E669E; Mon, 21 Nov 2022 09:50:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669020665; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ajs0bZcH95LXKj1Rclh6Teto9EWPgTTXw2RkvgSFeTA=; b=eC3Gsutn7wV8IM4TkQx9GtuxgM9Pg2PEGhoAq7Q2CanhPlESz+Bdc/I2SWUV5o8Gktq0Gb Bvoc83G8iTHK8B8tvbWDdLm4cidPygCpDk4fM7IFd5lyqZ/5cfa+9wzeJIiy70jQhQDyQI +ilwotWuOwdaIic8CuN3FZUGvwWDrAA= X-MC-Unique: qJ3SIDp8OreIcgq_GLHHvA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: eblake@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH 09/10] qapi: Use returned bool to check for failure (again) Date: Mon, 21 Nov 2022 09:50:53 +0100 Message-Id: <20221121085054.683122-10-armbru@redhat.com> In-Reply-To: <20221121085054.683122-1-armbru@redhat.com> References: <20221121085054.683122-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669020737845100001 Content-Type: text/plain; charset="utf-8" Commit 012d4c96e2 changed the visitor functions taking Error ** to return bool instead of void, and the commits following it used the new return value to simplify error checking. Since then a few more uses in need of the same treatment crept in. Do that. All pretty mechanical except for * balloon_stats_get_all() This is basically the same transformation commit 012d4c96e2 applied to the virtual walk example in include/qapi/visitor.h. * set_max_queue_size() Additionally replace "goto end of function" by return. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/kvm/kvm-all.c | 5 +---- hw/core/qdev-properties-system.c | 5 +---- hw/i386/pc.c | 5 +---- hw/virtio/virtio-balloon.c | 20 +++++++++----------- hw/virtio/virtio-mem.c | 10 ++-------- net/colo-compare.c | 13 ++++--------- target/i386/kvm/kvm.c | 5 +---- util/thread-context.c | 10 ++-------- 8 files changed, 21 insertions(+), 52 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index f99b0becd8..e86c33e0e6 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -3586,7 +3586,6 @@ static void kvm_set_dirty_ring_size(Object *obj, Visi= tor *v, Error **errp) { KVMState *s =3D KVM_STATE(obj); - Error *error =3D NULL; uint32_t value; =20 if (s->fd !=3D -1) { @@ -3594,9 +3593,7 @@ static void kvm_set_dirty_ring_size(Object *obj, Visi= tor *v, return; } =20 - visit_type_uint32(v, name, &value, &error); - if (error) { - error_propagate(errp, error); + if (!visit_type_uint32(v, name, &value, errp)) { return; } if (value & (value - 1)) { diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index a91f60567a..97a968f477 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -679,14 +679,11 @@ static void set_reserved_region(Object *obj, Visitor = *v, const char *name, { Property *prop =3D opaque; ReservedRegion *rr =3D object_field_prop_ptr(obj, prop); - Error *local_err =3D NULL; const char *endptr; char *str; int ret; =20 - visit_type_str(v, name, &str, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!visit_type_str(v, name, &str, errp)) { return; } =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 546b703cb4..fa69b6f43e 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1782,12 +1782,9 @@ static void pc_machine_set_max_fw_size(Object *obj, = Visitor *v, Error **errp) { PCMachineState *pcms =3D PC_MACHINE(obj); - Error *error =3D NULL; uint64_t value; =20 - visit_type_size(v, name, &value, &error); - if (error) { - error_propagate(errp, error); + if (!visit_type_size(v, name, &value, errp)) { return; } =20 diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 73ac5eb675..746f07c4d2 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -241,36 +241,34 @@ static void balloon_stats_poll_cb(void *opaque) static void balloon_stats_get_all(Object *obj, Visitor *v, const char *nam= e, void *opaque, Error **errp) { - Error *err =3D NULL; VirtIOBalloon *s =3D VIRTIO_BALLOON(obj); + bool ok =3D false; int i; =20 - if (!visit_start_struct(v, name, NULL, 0, &err)) { - goto out; + if (!visit_start_struct(v, name, NULL, 0, errp)) { + return; } - if (!visit_type_int(v, "last-update", &s->stats_last_update, &err)) { + if (!visit_type_int(v, "last-update", &s->stats_last_update, errp)) { goto out_end; } =20 - if (!visit_start_struct(v, "stats", NULL, 0, &err)) { + if (!visit_start_struct(v, "stats", NULL, 0, errp)) { goto out_end; } for (i =3D 0; i < VIRTIO_BALLOON_S_NR; i++) { - if (!visit_type_uint64(v, balloon_stat_names[i], &s->stats[i], &er= r)) { + if (!visit_type_uint64(v, balloon_stat_names[i], &s->stats[i], err= p)) { goto out_nested; } } - visit_check_struct(v, &err); + ok =3D visit_check_struct(v, errp); out_nested: visit_end_struct(v, NULL); =20 - if (!err) { - visit_check_struct(v, &err); + if (ok) { + visit_check_struct(v, errp); } out_end: visit_end_struct(v, NULL); -out: - error_propagate(errp, err); } =20 static void balloon_stats_get_poll_interval(Object *obj, Visitor *v, diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index ed170def48..d96bde1fab 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -1094,12 +1094,9 @@ static void virtio_mem_set_requested_size(Object *ob= j, Visitor *v, Error **errp) { VirtIOMEM *vmem =3D VIRTIO_MEM(obj); - Error *err =3D NULL; uint64_t value; =20 - visit_type_size(v, name, &value, &err); - if (err) { - error_propagate(errp, err); + if (!visit_type_size(v, name, &value, errp)) { return; } =20 @@ -1159,7 +1156,6 @@ static void virtio_mem_set_block_size(Object *obj, Vi= sitor *v, const char *name, void *opaque, Error **errp) { VirtIOMEM *vmem =3D VIRTIO_MEM(obj); - Error *err =3D NULL; uint64_t value; =20 if (DEVICE(obj)->realized) { @@ -1167,9 +1163,7 @@ static void virtio_mem_set_block_size(Object *obj, Vi= sitor *v, const char *name, return; } =20 - visit_type_size(v, name, &value, &err); - if (err) { - error_propagate(errp, err); + if (!visit_type_size(v, name, &value, errp)) { return; } =20 diff --git a/net/colo-compare.c b/net/colo-compare.c index 787c740f14..7f9e6f89ce 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -1135,22 +1135,17 @@ static void set_max_queue_size(Object *obj, Visitor= *v, const char *name, void *opaque, Error **errp) { - Error *local_err =3D NULL; uint64_t value; =20 - visit_type_uint64(v, name, &value, &local_err); - if (local_err) { - goto out; + if (!visit_type_uint64(v, name, &value, errp)) { + return; } if (!value) { - error_setg(&local_err, "Property '%s.%s' requires a positive value= ", + error_setg(errp, "Property '%s.%s' requires a positive value", object_get_typename(obj), name); - goto out; + return; } max_queue_size =3D value; - -out: - error_propagate(errp, local_err); } =20 static void compare_pri_rs_finalize(SocketReadState *pri_rs) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index a213209379..0ab4e0734a 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -5689,7 +5689,6 @@ static void kvm_arch_set_notify_window(Object *obj, V= isitor *v, Error **errp) { KVMState *s =3D KVM_STATE(obj); - Error *error =3D NULL; uint32_t value; =20 if (s->fd !=3D -1) { @@ -5697,9 +5696,7 @@ static void kvm_arch_set_notify_window(Object *obj, V= isitor *v, return; } =20 - visit_type_uint32(v, name, &value, &error); - if (error) { - error_propagate(errp, error); + if (!visit_type_uint32(v, name, &value, errp)) { return; } =20 diff --git a/util/thread-context.c b/util/thread-context.c index 4138245332..2bc7883b9e 100644 --- a/util/thread-context.c +++ b/util/thread-context.c @@ -90,16 +90,13 @@ static void thread_context_set_cpu_affinity(Object *obj= , Visitor *v, uint16List *l, *host_cpus =3D NULL; unsigned long *bitmap =3D NULL; int nbits =3D 0, ret; - Error *err =3D NULL; =20 if (tc->init_cpu_bitmap) { error_setg(errp, "Mixing CPU and node affinity not supported"); return; } =20 - visit_type_uint16List(v, name, &host_cpus, &err); - if (err) { - error_propagate(errp, err); + if (!visit_type_uint16List(v, name, &host_cpus, errp)) { return; } =20 @@ -178,7 +175,6 @@ static void thread_context_set_node_affinity(Object *ob= j, Visitor *v, uint16List *l, *host_nodes =3D NULL; unsigned long *bitmap =3D NULL; struct bitmask *tmp_cpus; - Error *err =3D NULL; int ret, i; =20 if (tc->init_cpu_bitmap) { @@ -186,9 +182,7 @@ static void thread_context_set_node_affinity(Object *ob= j, Visitor *v, return; } =20 - visit_type_uint16List(v, name, &host_nodes, &err); - if (err) { - error_propagate(errp, err); + if (!visit_type_uint16List(v, name, &host_nodes, errp)) { return; } =20 --=20 2.37.3 From nobody Wed May 15 11:14:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669021028; cv=none; d=zohomail.com; s=zohoarc; b=MomrqkcY987Fx5FS1LVPQROxMeNFpKzPQxB8RlKX/PYzprMx46q8eyns1df5fWyPU4zxSunW/WvliUVkBhqeQ9f9fud0tJY8WDK8cmPgmkQfvL7zYEOCYoBwvdZ8ZiFsAK7a0P0MGEYaYVpU7i8SOzn2UUZ1gBEKgZw6HQ+JZEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669021028; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=r1ncKr9tFD+zpCOsE2YHiQ9G4LMwiA46HinCnVKxoNg=; b=mNTdjzV6RprEHPfJEVZHI2G2/n65tjOLHWTL9792oo778IDQpMmKAzqlpW59PFhl35E9tgsRoVl4CHK2YlLq+4tZXswp+t5KTxv0Xw2k4j5DCoTOdwhMh9NmlrhGY2YSdHoLPIom4QGC2NLAiNEyvLM4niUrrnu7Swwbovgxf90= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669021028314662.8758456151903; Mon, 21 Nov 2022 00:57:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ox2WH-0003TY-JA; Mon, 21 Nov 2022 03:51:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WF-0003Sc-GI for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ox2WD-00019n-Sz for qemu-devel@nongnu.org; Mon, 21 Nov 2022 03:51:11 -0500 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-261-wcMltAgJO5-9GH3BRXrYzA-1; Mon, 21 Nov 2022 03:51:01 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E8EB4833A0E; Mon, 21 Nov 2022 08:51:00 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.39.192.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C5CEF492B11; Mon, 21 Nov 2022 08:51:00 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6756121E65C5; Mon, 21 Nov 2022 09:50:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669020669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=r1ncKr9tFD+zpCOsE2YHiQ9G4LMwiA46HinCnVKxoNg=; b=W2sC44F0gGWt2GQAmtTm+LtoUN0QT307lVxiJJfWbQa2AQF0pv8XksrCivJBi42jXOXOdf djMXeXBYkgSaMhqbcuM3l2C+U7EcdQ5V5o8KrrIWr232Jiq+6A6G0RLJKZqgnsEgw8Vxiu h3ade83WkZ737q8J4I58Oba3DWE4C0g= X-MC-Unique: wcMltAgJO5-9GH3BRXrYzA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: eblake@redhat.com, vsementsov@yandex-team.ru Subject: [PATCH 10/10] io: Tidy up fat-fingered parameter name Date: Mon, 21 Nov 2022 09:50:54 +0100 Message-Id: <20221121085054.683122-11-armbru@redhat.com> In-Reply-To: <20221121085054.683122-1-armbru@redhat.com> References: <20221121085054.683122-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669021030126100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/io/channel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/io/channel.h b/include/io/channel.h index c680ee7480..f1b7e05f81 100644 --- a/include/io/channel.h +++ b/include/io/channel.h @@ -350,7 +350,7 @@ int qio_channel_readv_all(QIOChannel *ioc, int qio_channel_writev_all(QIOChannel *ioc, const struct iovec *iov, size_t niov, - Error **erp); + Error **errp); =20 /** * qio_channel_readv: --=20 2.37.3