To avoid to access the USBDevice internals, and use the recently added usb_get_port_path() helper instead.
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- hw/ppc/spapr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index f6f034d039..221d3e7a8c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3121,7 +3121,8 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus, * We use SRP luns of the form 01000000 | (usb-port << 16) | lun * in the top 32 bits of the 64-bit LUN */ - unsigned usb_port = atoi(usb->port->path); + g_autofree char *usb_port_path = usb_get_port_path(usb); + unsigned usb_port = atoi(usb_port_path); unsigned id = 0x1000000 | (usb_port << 16) | d->lun; return g_strdup_printf("%s@%"PRIX64, qdev_fw_name(dev), (uint64_t)id << 32); @@ -3137,7 +3138,8 @@ static char *spapr_get_fw_dev_path(FWPathProvider *p, BusState *bus, if (strcmp("usb-host", qdev_fw_name(dev)) == 0) { USBDevice *usbdev = CAST(USBDevice, dev, TYPE_USB_DEVICE); if (usb_host_dev_is_scsi_storage(usbdev)) { - return g_strdup_printf("storage@%s/disk", usbdev->port->path); + g_autofree char *usb_port_path = usb_get_port_path(usbdev); + return g_strdup_printf("storage@%s/disk", usb_port_path); } } -- 2.21.3