mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 18:44:58 -06:00
hw/ide: Fix crash when plugging a piix3-ide device into the x-remote machine
QEMU currently crashes when the user tries to do something like: qemu-system-x86_64 -M x-remote -device piix3-ide This happens because the "isabus" variable is not initialized with the x-remote machine yet. Add a proper check for this condition and propagate the error to the caller, so we can fail there gracefully. Message-Id: <20210416125256.2039734-1-thuth@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
283f0a05e2
commit
9405d87be2
5 changed files with 46 additions and 21 deletions
|
@ -131,13 +131,17 @@ void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start)
|
|||
isa_init_ioport(dev, start);
|
||||
}
|
||||
|
||||
void isa_register_portio_list(ISADevice *dev,
|
||||
PortioList *piolist, uint16_t start,
|
||||
const MemoryRegionPortio *pio_start,
|
||||
void *opaque, const char *name)
|
||||
int isa_register_portio_list(ISADevice *dev,
|
||||
PortioList *piolist, uint16_t start,
|
||||
const MemoryRegionPortio *pio_start,
|
||||
void *opaque, const char *name)
|
||||
{
|
||||
assert(piolist && !piolist->owner);
|
||||
|
||||
if (!isabus) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* START is how we should treat DEV, regardless of the actual
|
||||
contents of the portio array. This is how the old code
|
||||
actually handled e.g. the FDC device. */
|
||||
|
@ -145,6 +149,8 @@ void isa_register_portio_list(ISADevice *dev,
|
|||
|
||||
portio_list_init(piolist, OBJECT(dev), pio_start, opaque, name);
|
||||
portio_list_add(piolist, isabus->address_space_io, start);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void isa_device_init(Object *obj)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue