Skip to content

Commit 05e385d

Browse files
author
Markus Armbruster
committed
error: Move ERRP_GUARD() to the beginning of the function
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 <[email protected]> Message-Id: <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
1 parent 740d6c4 commit 05e385d

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

hw/arm/armsse.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,7 @@ static qemu_irq armsse_get_common_irq_in(ARMSSE *s, int irqno)
900900

901901
static void armsse_realize(DeviceState *dev, Error **errp)
902902
{
903+
ERRP_GUARD();
903904
ARMSSE *s = ARM_SSE(dev);
904905
ARMSSEClass *asc = ARM_SSE_GET_CLASS(dev);
905906
const ARMSSEInfo *info = asc->info;
@@ -914,8 +915,6 @@ static void armsse_realize(DeviceState *dev, Error **errp)
914915
DeviceState *dev_splitter;
915916
uint32_t addr_width_max;
916917

917-
ERRP_GUARD();
918-
919918
if (!s->board_memory) {
920919
error_setg(errp, "memory property was not set");
921920
return;

hw/core/machine.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -554,12 +554,11 @@ static void machine_get_mem(Object *obj, Visitor *v, const char *name,
554554
static void machine_set_mem(Object *obj, Visitor *v, const char *name,
555555
void *opaque, Error **errp)
556556
{
557+
ERRP_GUARD();
557558
MachineState *ms = MACHINE(obj);
558559
MachineClass *mc = MACHINE_GET_CLASS(obj);
559560
MemorySizeConfiguration *mem;
560561

561-
ERRP_GUARD();
562-
563562
if (!visit_type_MemorySizeConfiguration(v, name, &mem, errp)) {
564563
return;
565564
}

hw/virtio/vhost-vdpa.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,7 @@ static bool vhost_vdpa_svq_map_rings(struct vhost_dev *dev,
963963
struct vhost_vring_addr *addr,
964964
Error **errp)
965965
{
966+
ERRP_GUARD();
966967
DMAMap device_region, driver_region;
967968
struct vhost_vring_addr svq_addr;
968969
struct vhost_vdpa *v = dev->opaque;
@@ -971,7 +972,6 @@ static bool vhost_vdpa_svq_map_rings(struct vhost_dev *dev,
971972
size_t avail_offset;
972973
bool ok;
973974

974-
ERRP_GUARD();
975975
vhost_svq_get_vring_addr(svq, &svq_addr);
976976

977977
driver_region = (DMAMap) {

iothread.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ static void iothread_init_gcontext(IOThread *iothread)
155155

156156
static void iothread_set_aio_context_params(EventLoopBase *base, Error **errp)
157157
{
158-
IOThread *iothread = IOTHREAD(base);
159158
ERRP_GUARD();
159+
IOThread *iothread = IOTHREAD(base);
160160

161161
if (!iothread->ctx) {
162162
return;

monitor/qmp-cmds.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,9 @@ static bool invoke_stats_cb(StatsCallbacks *entry,
474474
StatsFilter *filter, StatsRequest *request,
475475
Error **errp)
476476
{
477+
ERRP_GUARD();
477478
strList *targets = NULL;
478479
strList *names = NULL;
479-
ERRP_GUARD();
480480

481481
if (request) {
482482
if (request->provider != entry->provider) {
@@ -541,9 +541,9 @@ StatsSchemaList *qmp_query_stats_schemas(bool has_provider,
541541
StatsProvider provider,
542542
Error **errp)
543543
{
544+
ERRP_GUARD();
544545
StatsSchemaList *stats_results = NULL;
545546
StatsCallbacks *entry;
546-
ERRP_GUARD();
547547

548548
QTAILQ_FOREACH(entry, &stats_callbacks, next) {
549549
if (!has_provider || provider == entry->provider) {

0 commit comments

Comments
 (0)