[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/14] error: Move ERRP_GUARD() to the beginning of the function
From: |
Markus Armbruster |
Subject: |
[PULL 04/14] error: Move ERRP_GUARD() to the beginning of the function |
Date: |
Wed, 14 Dec 2022 17:46:19 +0100 |
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 <armbru@redhat.com>
Message-Id: <20221121085054.683122-4-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
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)
static void armsse_realize(DeviceState *dev, Error **errp)
{
+ ERRP_GUARD();
ARMSSE *s = ARM_SSE(dev);
ARMSSEClass *asc = ARM_SSE_GET_CLASS(dev);
const ARMSSEInfo *info = asc->info;
@@ -914,8 +915,6 @@ static void armsse_realize(DeviceState *dev, Error **errp)
DeviceState *dev_splitter;
uint32_t addr_width_max;
- 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 = MACHINE(obj);
MachineClass *mc = MACHINE_GET_CLASS(obj);
MemorySizeConfiguration *mem;
- 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 = dev->opaque;
@@ -971,7 +972,6 @@ static bool vhost_vdpa_svq_map_rings(struct vhost_dev *dev,
size_t avail_offset;
bool ok;
- ERRP_GUARD();
vhost_svq_get_vring_addr(svq, &svq_addr);
driver_region = (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)
static void iothread_set_aio_context_params(EventLoopBase *base, Error **errp)
{
- IOThread *iothread = IOTHREAD(base);
ERRP_GUARD();
+ IOThread *iothread = IOTHREAD(base);
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 = NULL;
strList *names = NULL;
- ERRP_GUARD();
if (request) {
if (request->provider != entry->provider) {
@@ -541,9 +541,9 @@ StatsSchemaList *qmp_query_stats_schemas(bool has_provider,
StatsProvider provider,
Error **errp)
{
+ ERRP_GUARD();
StatsSchemaList *stats_results = NULL;
StatsCallbacks *entry;
- ERRP_GUARD();
QTAILQ_FOREACH(entry, &stats_callbacks, next) {
if (!has_provider || provider == entry->provider) {
--
2.37.3
- [PULL 00/14] Miscellaneous patches for 2022-12-14, Markus Armbruster, 2022/12/14
- [PULL 01/14] Drop more useless casts from void * to pointer, Markus Armbruster, 2022/12/14
- [PULL 05/14] monitor: Simplify monitor_fd_param()'s error handling, Markus Armbruster, 2022/12/14
- [PULL 09/14] sockets: Use ERRP_GUARD() where obviously appropriate, Markus Armbruster, 2022/12/14
- [PULL 10/14] qapi: Use returned bool to check for failure (again), Markus Armbruster, 2022/12/14
- [PULL 14/14] ppc4xx_sdram: Simplify sdram_ddr_size() to return, Markus Armbruster, 2022/12/14
- [PULL 12/14] cleanup: Tweak and re-run return_directly.cocci, Markus Armbruster, 2022/12/14
- [PULL 04/14] error: Move ERRP_GUARD() to the beginning of the function,
Markus Armbruster <=
- [PULL 02/14] error: Drop some obviously superfluous error_propagate(), Markus Armbruster, 2022/12/14
- [PULL 03/14] error: Drop a few superfluous ERRP_GUARD(), Markus Armbruster, 2022/12/14
- [PULL 08/14] qemu-config: Use ERRP_GUARD() where obviously appropriate, Markus Armbruster, 2022/12/14
- [PULL 11/14] io: Tidy up fat-fingered parameter name, Markus Armbruster, 2022/12/14
- [PULL 07/14] qemu-config: Make config_parse_qdict() return bool, Markus Armbruster, 2022/12/14
- [PULL 06/14] monitor: Use ERRP_GUARD() in monitor_init(), Markus Armbruster, 2022/12/14
- [PULL 13/14] block/vmdk: Simplify vmdk_co_create() to return directly, Markus Armbruster, 2022/12/14
- Re: [PULL 00/14] Miscellaneous patches for 2022-12-14, Peter Maydell, 2022/12/15