qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/4] sdbus: add a QMP command to access a SDB


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH v2 1/4] sdbus: add a QMP command to access a SDBus
Date: Fri, 5 Jan 2018 18:28:51 -0300

Hi Eric,

On Fri, Jan 5, 2018 at 12:29 PM, Eric Blake <address@hidden> 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;
>> +    }



reply via email to

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