summaryrefslogtreecommitdiffstats
path: root/hw/block/fdc.c
diff options
context:
space:
mode:
authorAlexey Kardashevskiy2018-03-16 10:51:30 +0100
committerPaolo Bonzini2018-03-26 14:37:13 +0200
commitb3da551389c86ce214d5418c174134c3e1c838ab (patch)
treec23a01af5bb298ac1b26e402afa7e67d6ea80e77 /hw/block/fdc.c
parenthw/net/can: Fix segfaults when using the devices without bus (diff)
downloadqemu-b3da551389c86ce214d5418c174134c3e1c838ab.tar.gz
qemu-b3da551389c86ce214d5418c174134c3e1c838ab.tar.xz
qemu-b3da551389c86ce214d5418c174134c3e1c838ab.zip
fdc: Exit if ISA controller does not support DMA
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 <aik@ozlabs.ru> [thuth: Slightly adjusted error message and updated scripts/device-crash-test] Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1521193892-15552-3-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/block/fdc.c')
-rw-r--r--hw/block/fdc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 7b7dd41296..cd29e27d8f 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -2695,7 +2695,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");
+ return;
+ }
}
qdev_set_legacy_instance_id(dev, isa->iobase, 2);