[GEDI] [RFC v2 8/9] fix-compilation: empty goto

Vladimir Sementsov-Ogievskiy vsementsov at virtuozzo.com
Mon Sep 23 16:12:30 UTC 2019


I don't understand, why these special cases are not handled by
coccinelle. Possibly, it's a bug in coccinelle itself.

If no other ideas, these fixes may be just merged to autogenerated
commit(commits), with appropriate notice in commit message.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov at virtuozzo.com>
---
 backends/cryptodev.c    | 7 -------
 hw/dma/xilinx_axidma.c  | 7 ++-----
 hw/net/xilinx_axienet.c | 7 ++-----
 hw/ppc/spapr.c          | 3 +--
 hw/ppc/spapr_cpu_core.c | 3 +--
 hw/s390x/s390-ccw.c     | 3 +--
 hw/vfio/ap.c            | 3 +--
 hw/vfio/ccw.c           | 3 +--
 8 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/backends/cryptodev.c b/backends/cryptodev.c
index dcdb8481b2..aa4a62ace0 100644
--- a/backends/cryptodev.c
+++ b/backends/cryptodev.c
@@ -176,14 +176,7 @@ cryptodev_backend_complete(UserCreatable *uc, Error **errp)
 
     if (bc->init) {
         bc->init(backend, errp);
-        if (*errp) {
-            goto out;
-        }
     }
-
-    return;
-
-out:
 }
 
 void cryptodev_backend_set_used(CryptoDevBackend *backend, bool used)
diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
index b5f49e6f88..b5456f5db2 100644
--- a/hw/dma/xilinx_axidma.c
+++ b/hw/dma/xilinx_axidma.c
@@ -536,12 +536,12 @@ static void xilinx_axidma_realize(DeviceState *dev, Error **errp)
                              OBJ_PROP_LINK_STRONG,
                              errp);
     if (*errp) {
-        goto xilinx_axidma_realize_fail;
+        return;
     }
     object_property_set_link(OBJECT(ds), OBJECT(s), "dma", errp);
     object_property_set_link(OBJECT(cs), OBJECT(s), "dma", errp);
     if (*errp) {
-        goto xilinx_axidma_realize_fail;
+        return;
     }
 
     int i;
@@ -554,9 +554,6 @@ static void xilinx_axidma_realize(DeviceState *dev, Error **errp)
         st->ptimer = ptimer_init(st->bh, PTIMER_POLICY_DEFAULT);
         ptimer_set_freq(st->ptimer, s->freqhz);
     }
-    return;
-
-xilinx_axidma_realize_fail:
 }
 
 static void xilinx_axidma_init(Object *obj)
diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
index 5f87a6336b..372ca88956 100644
--- a/hw/net/xilinx_axienet.c
+++ b/hw/net/xilinx_axienet.c
@@ -963,12 +963,12 @@ static void xilinx_enet_realize(DeviceState *dev, Error **errp)
                              OBJ_PROP_LINK_STRONG,
                              errp);
     if (*errp) {
-        goto xilinx_enet_realize_fail;
+        return;
     }
     object_property_set_link(OBJECT(ds), OBJECT(s), "enet", errp);
     object_property_set_link(OBJECT(cs), OBJECT(s), "enet", errp);
     if (*errp) {
-        goto xilinx_enet_realize_fail;
+        return;
     }
 
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
@@ -982,9 +982,6 @@ static void xilinx_enet_realize(DeviceState *dev, Error **errp)
     s->TEMAC.parent = s;
 
     s->rxmem = g_malloc(s->c_rxmem);
-    return;
-
-xilinx_enet_realize_fail:
 }
 
 static void xilinx_enet_init(Object *obj)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 5ef043bd72..7b0ab71f23 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3503,7 +3503,7 @@ static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
 
     pc_dimm_plug(dimm, MACHINE(ms), errp);
     if (*errp) {
-        goto out;
+        return;
     }
 
     addr = object_property_get_uint(OBJECT(dimm),
@@ -3522,7 +3522,6 @@ static void spapr_memory_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
 
 out_unplug:
     pc_dimm_unplug(dimm, MACHINE(ms));
-out:
 }
 
 static void spapr_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index 93f9b0e0c9..c35696ff42 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -224,7 +224,7 @@ static void spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
 
     object_property_set_bool(OBJECT(cpu), true, "realized", errp);
     if (*errp) {
-        goto error;
+        return;
     }
 
     /* Set time-base frequency to 512 MHz */
@@ -251,7 +251,6 @@ static void spapr_realize_vcpu(PowerPCCPU *cpu, SpaprMachineState *spapr,
 error_unregister:
     qemu_unregister_reset(spapr_cpu_reset, cpu);
     cpu_remove_sync(CPU(cpu));
-error:
 }
 
 static PowerPCCPU *spapr_create_vcpu(SpaprCpuCore *sc, int i, Error **errp)
diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c
index 0ae1951507..8695d2c445 100644
--- a/hw/s390x/s390-ccw.c
+++ b/hw/s390x/s390-ccw.c
@@ -94,7 +94,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
 
     s390_ccw_get_dev_info(cdev, sysfsdev, errp);
     if (*errp) {
-        goto out_err_propagate;
+        return;
     }
 
     sch = css_create_sch(ccw_dev->devno, errp);
@@ -127,7 +127,6 @@ out_err:
     g_free(sch);
 out_mdevid_free:
     g_free(cdev->mdevid);
-out_err_propagate:
 }
 
 static void s390_ccw_unrealize(S390CCWDevice *cdev, Error **errp)
diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index e072a08f1d..8fbaa724c2 100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -95,7 +95,7 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp)
 
     vfio_group = vfio_ap_get_group(vapdev, errp);
     if (!vfio_group) {
-        goto out_err;
+        return;
     }
 
     vapdev->vdev.ops = &vfio_ap_ops;
@@ -122,7 +122,6 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp)
 out_get_dev_err:
     vfio_ap_put_device(vapdev);
     vfio_put_group(vfio_group);
-out_err:
 }
 
 static void vfio_ap_unrealize(DeviceState *dev, Error **errp)
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index d2b526667e..c24ffdb3af 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -486,7 +486,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
     if (cdc->realize) {
         cdc->realize(cdev, vcdev->vdev.sysfsdev, errp);
         if (*errp) {
-            goto out_err_propagate;
+            return;
         }
     }
 
@@ -522,7 +522,6 @@ out_group_err:
     if (cdc->unrealize) {
         cdc->unrealize(cdev, NULL);
     }
-out_err_propagate:
 }
 
 static void vfio_ccw_unrealize(DeviceState *dev, Error **errp)
-- 
2.21.0



More information about the integration mailing list