]> Git Repo - qemu.git/commit
hw: Remove unnecessary DEVICE() cast
authorPhilippe Mathieu-Daudé <[email protected]>
Tue, 12 May 2020 07:00:20 +0000 (09:00 +0200)
committerMarkus Armbruster <[email protected]>
Fri, 15 May 2020 05:08:52 +0000 (07:08 +0200)
commit8e5c952b370b57beb642826882c80e1b66a9cf12
tree1fad74d43f0e2e8a6424df685757d67cfbbae02e
parent688ffbb4f72bf9a75c7ff3a899a9617de61d5fd6
hw: Remove unnecessary DEVICE() cast

The DEVICE() macro is defined as:

  #define DEVICE(obj) OBJECT_CHECK(DeviceState, (obj), TYPE_DEVICE)

which expands to:

  ((DeviceState *)object_dynamic_cast_assert((Object *)(obj), (name),
                                             __FILE__, __LINE__,
                                             __func__))

This assertion can only fail when @obj points to something other
than its stated type, i.e. when we're in undefined behavior country.

Remove the unnecessary DEVICE() casts when we already know the
pointer is of DeviceState type.

Patch created mechanically using spatch with this script:

  @@
  typedef DeviceState;
  DeviceState *s;
  @@
  -   DEVICE(s)
  +   s

Acked-by: David Gibson <[email protected]>
Acked-by: Paul Durrant <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Acked-by: John Snow <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200512070020[email protected]>
16 files changed:
hw/display/artist.c
hw/display/cg3.c
hw/display/sm501.c
hw/display/tcx.c
hw/display/vga-isa.c
hw/i2c/imx_i2c.c
hw/i2c/mpc_i2c.c
hw/ide/piix.c
hw/misc/macio/pmu.c
hw/net/ftgmac100.c
hw/net/imx_fec.c
hw/nubus/nubus-device.c
hw/pci-host/bonito.c
hw/ppc/spapr.c
hw/sh4/sh_pci.c
hw/xen/xen-legacy-backend.c
This page took 0.026998 seconds and 4 git commands to generate.