qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH qemu] fdc: Exit if ISA controller does not support D


From: Alexey Kardashevskiy
Subject: [Qemu-devel] [PATCH qemu] fdc: Exit if ISA controller does not support DMA
Date: Thu, 26 Oct 2017 17:46:35 +1100

A "powernv" machine type defines an ISA bus but it does not add any DMA
controller to it so it is possible to hit assert(fdctrl->dma) by
adding "-machine powernv -device isa-fdc".

This replaces assert() with an error message.

Signed-off-by: Alexey Kardashevskiy <address@hidden>
---

Is it a must for ISA to have DMA controllers?


---
 hw/block/fdc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 67f78ac702..ed8b367572 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -2700,7 +2700,10 @@ static void isabus_fdc_realize(DeviceState *dev, Error 
**errp)
     fdctrl->dma_chann = isa->dma;
     if (fdctrl->dma_chann != -1) {
         fdctrl->dma = isa_get_dma(isa_bus_from_device(isadev), isa->dma);
-        assert(fdctrl->dma);
+        if (!fdctrl->dma) {
+            error_setg(errp, "ISA controller does not support DMA, exiting");
+            return;
+        }
     }
 
     qdev_set_legacy_instance_id(dev, isa->iobase, 2);
-- 
2.11.0




reply via email to

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