On 10/17/25 15:06, deller@kernel.org wrote:
> From: Helge Deller <deller@gmx.de>
>
> Only create the PCI serial ports (DIVA) and PCI network cards when there is
> actually a PCI bus. The shortly added 715 machine will not have a PCI bus, so
> avoid creating further PCI devices.
>
> Signed-off-by: Helge Deller <deller@gmx.de>
> ---
> hw/hppa/machine.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
> index bec5a86f24..b6cdbc74ba 100644
> --- a/hw/hppa/machine.c
> +++ b/hw/hppa/machine.c
> @@ -387,11 +387,13 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,
> enable_lasi_lan());
> }
>
> - pci_init_nic_devices(pci_bus, mc->default_nic);
> + if (pci_bus) {
> + pci_init_nic_devices(pci_bus, mc->default_nic);
> + }
>
> /* BMC board: HP Diva GSP */
> - dev = qdev_new("diva-gsp");
> - if (!object_property_get_bool(OBJECT(dev), "disable", NULL)) {
> + dev = pci_bus ? qdev_new("diva-gsp") : NULL;
> + if (dev && !object_property_get_bool(OBJECT(dev), "disable", NULL)) {
Sequential testing of NULL pointers isn't ideal.
Better as
if (pci_bus) {
pci_init_nic_devices(pci_bus, mc->default_nic);
/* BMC board: HP Diva GSP */
dev = qdev_new("diva-gsp");
if (!object_property_get_bool(OBJECT(dev), "disable", NULL)) {
PCIDevice *pci_dev = pci_new_multifunction(...);
}
}
r~