mirror of https://github.com/xemu-project/xemu.git
hw/ide/piix: Pass Error* to pci_piix_init_ports() for better error msg
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230215112712.23110-20-philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
caa9146281
commit
511aa9f9e7
|
@ -121,7 +121,7 @@ static void piix_ide_reset(DeviceState *dev)
|
||||||
pci_set_byte(pci_conf + 0x20, 0x01); /* BMIBA: 20-23h */
|
pci_set_byte(pci_conf + 0x20, 0x01); /* BMIBA: 20-23h */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pci_piix_init_ports(PCIIDEState *d)
|
static bool pci_piix_init_ports(PCIIDEState *d, Error **errp)
|
||||||
{
|
{
|
||||||
static const struct {
|
static const struct {
|
||||||
int iobase;
|
int iobase;
|
||||||
|
@ -138,7 +138,9 @@ static int pci_piix_init_ports(PCIIDEState *d)
|
||||||
ret = ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase,
|
ret = ide_init_ioport(&d->bus[i], NULL, port_info[i].iobase,
|
||||||
port_info[i].iobase2);
|
port_info[i].iobase2);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
error_setg_errno(errp, -ret, "Failed to realize %s port %u",
|
||||||
|
object_get_typename(OBJECT(d)), i);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
ide_bus_init_output_irq(&d->bus[i],
|
ide_bus_init_output_irq(&d->bus[i],
|
||||||
isa_get_irq(NULL, port_info[i].isairq));
|
isa_get_irq(NULL, port_info[i].isairq));
|
||||||
|
@ -148,14 +150,13 @@ static int pci_piix_init_ports(PCIIDEState *d)
|
||||||
ide_bus_register_restart_cb(&d->bus[i]);
|
ide_bus_register_restart_cb(&d->bus[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
|
static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
|
||||||
{
|
{
|
||||||
PCIIDEState *d = PCI_IDE(dev);
|
PCIIDEState *d = PCI_IDE(dev);
|
||||||
uint8_t *pci_conf = dev->config;
|
uint8_t *pci_conf = dev->config;
|
||||||
int rc;
|
|
||||||
|
|
||||||
pci_conf[PCI_CLASS_PROG] = 0x80; // legacy ATA mode
|
pci_conf[PCI_CLASS_PROG] = 0x80; // legacy ATA mode
|
||||||
|
|
||||||
|
@ -164,10 +165,8 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error **errp)
|
||||||
|
|
||||||
vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_pci, d);
|
vmstate_register(VMSTATE_IF(dev), 0, &vmstate_ide_pci, d);
|
||||||
|
|
||||||
rc = pci_piix_init_ports(d);
|
if (!pci_piix_init_ports(d, errp)) {
|
||||||
if (rc) {
|
return;
|
||||||
error_setg_errno(errp, -rc, "Failed to realize %s",
|
|
||||||
object_get_typename(OBJECT(dev)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue