From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXZXq-0001g9-Iv for qemu-devel@nongnu.org; Fri, 05 Jan 2018 16:28:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXZXp-0005VY-5W for qemu-devel@nongnu.org; Fri, 05 Jan 2018 16:28:54 -0500 Received: from mail-it0-x231.google.com ([2607:f8b0:4001:c0b::231]:39655) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eXZXo-0005VB-VE for qemu-devel@nongnu.org; Fri, 05 Jan 2018 16:28:53 -0500 Received: by mail-it0-x231.google.com with SMTP id 68so3129071ite.4 for ; Fri, 05 Jan 2018 13:28:52 -0800 (PST) MIME-Version: 1.0 Sender: philippe.mathieu.daude@gmail.com In-Reply-To: <58860a06-3d3f-ab2a-90ea-dd56dfbe9d79@redhat.com> References: <20180103214925.16677-1-f4bug@amsat.org> <20180103214925.16677-2-f4bug@amsat.org> <58860a06-3d3f-ab2a-90ea-dd56dfbe9d79@redhat.com> From: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Date: Fri, 5 Jan 2018 18:28:51 -0300 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 1/4] sdbus: add a QMP command to access a SDBus List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Alistair Francis , Peter Maydell , Paolo Bonzini , Kevin Wolf , Eduardo Habkost , "Daniel P . Berrange" , Stefan Hajnoczi , "qemu-devel@nongnu.org Developers" , "Edgar E . Iglesias" , Markus Armbruster , Thomas Huth , =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Hi Eric, On Fri, Jan 5, 2018 at 12:29 PM, Eric Blake wrote: > On 01/03/2018 03:49 PM, Philippe Mathieu-Daud=C3=A9 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 =3D (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=3Dincompatible-pointer-types] sdbus =3D object_dynamic_cast(obj, TYPE_SD_BUS); ^ > >> + if (sdbus =3D=3D NULL) { >> + error_set(errp, ERROR_CLASS_GENERIC_ERROR, >> + "Device '%s' not a sd-bus", qom_path); >> + return NULL; >> + }