qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/arm/sysbus-fdt: fix assert in match function
@ 2018-11-17 19:22 Peng Hao
  2018-11-17 16:10 ` Auger Eric
  0 siblings, 1 reply; 3+ messages in thread
From: Peng Hao @ 2018-11-17 19:22 UTC (permalink / raw)
  To: peter.maydell; +Cc: qemu-arm, qemu-devel, Peng Hao

In match function it should not call OBJECK_CHECK. When there is
a mismatch, we should continue to match rather than assert().

Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
---
 hw/arm/sysbus-fdt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c
index 0e24c80..41b962d 100644
--- a/hw/arm/sysbus-fdt.c
+++ b/hw/arm/sysbus-fdt.c
@@ -419,10 +419,15 @@ static int add_amd_xgbe_fdt_node(SysBusDevice *sbdev, void *opaque)
 static bool vfio_platform_match(SysBusDevice *sbdev,
                                 const BindingEntry *entry)
 {
-    VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev);
+    VFIOPlatformDevice *vdev;
     const char *compat;
     unsigned int n;
 
+    vdev = (VFIOPlatformDevice *) object_dynamic_cast(OBJECT(sbdev),
+                                                TYPE_VFIO_PLATFORM);
+    if (!vdev)
+        return false;
+
     for (n = vdev->num_compat, compat = vdev->compat; n > 0;
          n--, compat += strlen(compat) + 1) {
         if (!strcmp(entry->compat, compat)) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-19 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-17 19:22 [Qemu-devel] [PATCH] hw/arm/sysbus-fdt: fix assert in match function Peng Hao
2018-11-17 16:10 ` Auger Eric
2018-11-19 13:10   ` [Qemu-devel] [PATCH] hw/arm/sysbus-fdt: fix assert in matchfunction peng.hao2

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).