From 8e5c952b370b57beb642826882c80e1b66a9cf12 Mon Sep 17 00:00:00 2001 From: Philippe Mathieu-Daudé Date: Tue, 12 May 2020 09:00:20 +0200 Subject: 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 Acked-by: Paul Durrant Reviewed-by: Markus Armbruster Reviewed-by: Cédric Le Goater Acked-by: John Snow Reviewed-by: Richard Henderson Reviewed-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20200512070020.22782-4-f4bug@amsat.org> --- hw/display/sm501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw/display/sm501.c') diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 296cd56c4a..acc692531a 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1839,7 +1839,7 @@ static void sm501_init(SM501State *s, DeviceState *dev, &s->twoD_engine_region); /* create qemu graphic console */ - s->con = graphic_console_init(DEVICE(dev), 0, &sm501_ops, s); + s->con = graphic_console_init(dev, 0, &sm501_ops, s); } static const VMStateDescription vmstate_sm501_state = { -- cgit v1.2.3-55-g7522