Clean up test for qdev_init() failure
Some callers test for != 0, some for < 0. Normalize to < 0. Patchworks-ID: 35171 Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
dde8bbb44d
commit
5c17ca2505
2
hw/fdc.c
2
hw/fdc.c
@ -1847,7 +1847,7 @@ fdctrl_t *fdctrl_init_isa(DriveInfo **fds)
|
||||
dev = isa_create("isa-fdc");
|
||||
qdev_prop_set_drive(&dev->qdev, "driveA", fds[0]);
|
||||
qdev_prop_set_drive(&dev->qdev, "driveB", fds[1]);
|
||||
if (qdev_init(&dev->qdev) != 0)
|
||||
if (qdev_init(&dev->qdev) < 0)
|
||||
return NULL;
|
||||
return &(DO_UPCAST(fdctrl_isabus_t, busdev, dev)->state);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ int isa_ide_init(int iobase, int iobase2, int isairq,
|
||||
qdev_prop_set_uint32(&dev->qdev, "iobase", iobase);
|
||||
qdev_prop_set_uint32(&dev->qdev, "iobase2", iobase2);
|
||||
qdev_prop_set_uint32(&dev->qdev, "irq", isairq);
|
||||
if (qdev_init(&dev->qdev) != 0)
|
||||
if (qdev_init(&dev->qdev) < 0)
|
||||
return -1;
|
||||
|
||||
s = DO_UPCAST(ISAIDEState, dev, dev);
|
||||
|
@ -85,7 +85,7 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive)
|
||||
dev = qdev_create(&bus->qbus, "ide-drive");
|
||||
qdev_prop_set_uint32(dev, "unit", unit);
|
||||
qdev_prop_set_drive(dev, "drive", drive);
|
||||
if (qdev_init(dev) != 0)
|
||||
if (qdev_init(dev) < 0)
|
||||
return NULL;
|
||||
return DO_UPCAST(IDEDevice, qdev, dev);
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ ParallelState *parallel_init(int index, CharDriverState *chr)
|
||||
qdev_prop_set_uint32(&dev->qdev, "iobase", isa_parallel_io[index]);
|
||||
qdev_prop_set_uint32(&dev->qdev, "irq", 7);
|
||||
qdev_prop_set_chr(&dev->qdev, "chardev", chr);
|
||||
if (qdev_init(&dev->qdev) != 0)
|
||||
if (qdev_init(&dev->qdev) < 0)
|
||||
return NULL;
|
||||
return &DO_UPCAST(ISAParallelState, dev, dev)->state;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
||||
qdev_free(qdev);
|
||||
return NULL;
|
||||
}
|
||||
if (qdev_init(qdev) != 0) {
|
||||
if (qdev_init(qdev) < 0) {
|
||||
qemu_error("Error initializing device %s\n", driver);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -759,7 +759,7 @@ SerialState *serial_isa_init(int index, CharDriverState *chr)
|
||||
qdev_prop_set_uint32(&dev->qdev, "iobase", isa_serial_io[index]);
|
||||
qdev_prop_set_uint32(&dev->qdev, "irq", isa_serial_irq[index]);
|
||||
qdev_prop_set_chr(&dev->qdev, "chardev", chr);
|
||||
if (qdev_init(&dev->qdev) != 0)
|
||||
if (qdev_init(&dev->qdev) < 0)
|
||||
return NULL;
|
||||
return &DO_UPCAST(ISASerialState, dev, dev)->state;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user