qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCHv2] sysbus: Remove ignored return value of FindSysbus


From: David Gibson
Subject: [Qemu-devel] [PATCHv2] sysbus: Remove ignored return value of FindSysbusDeviceFunc
Date: Tue, 19 Jan 2016 12:45:35 +1100

Functions of type FindSysbusDeviceFunc currently return an integer.
However, this return value is always ignored by the caller in
find_sysbus_device().

This changes the function type to return void, to avoid confusion over
the function semantics.

Signed-off-by: David Gibson <address@hidden>
---

I recently screwed up a patch because the return value led me to a
wrong guess on the semantics; let's avoid others making the same error.

Changes in v2:
 * Reworded commit message to read better without context
 * Resending with correct qemu-devel address

 hw/arm/sysbus-fdt.c    | 4 ++--
 hw/core/machine.c      | 2 +-
 hw/core/platform-bus.c | 8 ++------
 hw/ppc/e500.c          | 4 +---
 hw/ppc/spapr.c         | 4 +---
 include/hw/sysbus.h    | 2 +-
 6 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c
index 68a3de5..1fc03fd 100644
--- a/hw/arm/sysbus-fdt.c
+++ b/hw/arm/sysbus-fdt.c
@@ -142,7 +142,7 @@ static const NodeCreationPair add_fdt_node_functions[] = {
  * are dynamically instantiable and if so call the node creation
  * function.
  */
-static int add_fdt_node(SysBusDevice *sbdev, void *opaque)
+static void add_fdt_node(SysBusDevice *sbdev, void *opaque)
 {
     int i, ret;
 
@@ -151,7 +151,7 @@ static int add_fdt_node(SysBusDevice *sbdev, void *opaque)
                     add_fdt_node_functions[i].typename)) {
             ret = add_fdt_node_functions[i].add_fdt_node_fn(sbdev, opaque);
             assert(!ret);
-            return 0;
+            return;
         }
     }
     error_report("Device %s can not be dynamically instantiated",
diff --git a/hw/core/machine.c b/hw/core/machine.c
index c46ddc7..792b471 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -311,7 +311,7 @@ static bool machine_get_suppress_vmdesc(Object *obj, Error 
**errp)
     return ms->suppress_vmdesc;
 }
 
-static int error_on_sysbus_device(SysBusDevice *sbdev, void *opaque)
+static void error_on_sysbus_device(SysBusDevice *sbdev, void *opaque)
 {
     error_report("Option '-device %s' cannot be handled by this machine",
                  object_class_get_name(object_get_class(OBJECT(sbdev))));
diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c
index aa55d01..2578471 100644
--- a/hw/core/platform-bus.c
+++ b/hw/core/platform-bus.c
@@ -73,7 +73,7 @@ hwaddr platform_bus_get_mmio_addr(PlatformBusDevice *pbus, 
SysBusDevice *sbdev,
     return object_property_get_int(OBJECT(sbdev_mr), "addr", NULL);
 }
 
-static int platform_bus_count_irqs(SysBusDevice *sbdev, void *opaque)
+static void platform_bus_count_irqs(SysBusDevice *sbdev, void *opaque)
 {
     PlatformBusDevice *pbus = opaque;
     qemu_irq sbirq;
@@ -92,8 +92,6 @@ static int platform_bus_count_irqs(SysBusDevice *sbdev, void 
*opaque)
             }
         }
     }
-
-    return 0;
 }
 
 /*
@@ -167,7 +165,7 @@ static void platform_bus_map_mmio(PlatformBusDevice *pbus, 
SysBusDevice *sbdev,
  * For each sysbus device, look for unassigned IRQ lines as well as
  * unassociated MMIO regions. Connect them to the platform bus if available.
  */
-static int link_sysbus_device(SysBusDevice *sbdev, void *opaque)
+static void link_sysbus_device(SysBusDevice *sbdev, void *opaque)
 {
     PlatformBusDevice *pbus = opaque;
     int i;
@@ -179,8 +177,6 @@ static int link_sysbus_device(SysBusDevice *sbdev, void 
*opaque)
     for (i = 0; sysbus_has_mmio(sbdev, i); i++) {
         platform_bus_map_mmio(pbus, sbdev, i);
     }
-
-    return 0;
 }
 
 static void platform_bus_init_notify(Notifier *notifier, void *data)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index bd7da47..37d9bc1 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -195,7 +195,7 @@ static int create_devtree_etsec(SysBusDevice *sbdev, 
PlatformDevtreeData *data)
     return 0;
 }
 
-static int sysbus_device_create_devtree(SysBusDevice *sbdev, void *opaque)
+static void sysbus_device_create_devtree(SysBusDevice *sbdev, void *opaque)
 {
     PlatformDevtreeData *data = opaque;
     bool matched = false;
@@ -210,8 +210,6 @@ static int sysbus_device_create_devtree(SysBusDevice 
*sbdev, void *opaque)
                      qdev_fw_name(DEVICE(sbdev)));
         exit(1);
     }
-
-    return 0;
 }
 
 static void platform_bus_create_devtree(PPCE500Params *params, void *fdt,
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 50e5a26..fbd4239 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1096,7 +1096,7 @@ static void spapr_reset_htab(sPAPRMachineState *spapr)
     }
 }
 
-static int find_unknown_sysbus_device(SysBusDevice *sbdev, void *opaque)
+static void find_unknown_sysbus_device(SysBusDevice *sbdev, void *opaque)
 {
     bool matched = false;
 
@@ -1109,8 +1109,6 @@ static int find_unknown_sysbus_device(SysBusDevice 
*sbdev, void *opaque)
                      qdev_fw_name(DEVICE(sbdev)));
         exit(1);
     }
-
-    return 0;
 }
 
 /*
diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
index cc1dba4..263f740 100644
--- a/include/hw/sysbus.h
+++ b/include/hw/sysbus.h
@@ -75,7 +75,7 @@ struct SysBusDevice {
     pio_addr_t pio[QDEV_MAX_PIO];
 };
 
-typedef int FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque);
+typedef void FindSysbusDeviceFunc(SysBusDevice *sbdev, void *opaque);
 
 void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory);
 MemoryRegion *sysbus_mmio_get_region(SysBusDevice *dev, int n);
-- 
2.5.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]