Hi Eric, On Fri, Jan 5, 2018 at 12:29 PM, Eric Blake <ebl...@redhat.com> wrote: > On 01/03/2018 03:49 PM, Philippe Mathieu-Daudé wrote: [...] >> + if (ambiguous) { >> + error_setg(errp, "Path '%s' is ambiguous", qom_path); >> + } else { >> + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, >> + "Device '%s' not found", qom_path); >> + } >> + return NULL; >> + } >> + sdbus = (SDBus *)object_dynamic_cast(obj, TYPE_SD_BUS); > > Is the cast still necessary, or does object_dynamic_cast() return void* > so that you can omit the cast?
Apparently the cast is necessary, since the object_dynamic_cast() returns an Object pointer, and the SD_BUS() macro uses object_dynamic_cast_assert() which generates a runtime assert. without casting: hw/sd/sdbus-qmp.c:37:11: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types] sdbus = object_dynamic_cast(obj, TYPE_SD_BUS); ^ > >> + if (sdbus == NULL) { >> + error_set(errp, ERROR_CLASS_GENERIC_ERROR, >> + "Device '%s' not a sd-bus", qom_path); >> + return NULL; >> + }