hw/net/lan9118: use qemu_configure_nic_device()

Some callers instantiate the device unconditionally, others will do so only
if there is a NICInfo to go with it. This appears to be fairly random, but
preseve the existing behaviour for now.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
David Woodhouse 2023-10-23 09:37:36 +01:00
parent cd53991de4
commit f138ed5e00
6 changed files with 10 additions and 13 deletions

View file

@ -85,7 +85,6 @@ static void realview_init(MachineState *machine,
SysBusDevice *busdev;
qemu_irq pic[64];
PCIBus *pci_bus = NULL;
NICInfo *nd;
DriveInfo *dinfo;
I2CBus *i2c;
int n;
@ -296,10 +295,9 @@ static void realview_init(MachineState *machine,
}
}
nd = qemu_find_nic_info(is_pb ? "lan9118" : "smc91c111", true, NULL);
if (nd) {
if (qemu_find_nic_info(is_pb ? "lan9118" : "smc91c111", true, NULL)) {
if (is_pb) {
lan9118_init(nd, 0x4e000000, pic[28]);
lan9118_init(0x4e000000, pic[28]);
} else {
smc91c111_init(0x4e000000, pic[28]);
}