Use the safer USB_HUB() QOM type-checking macro instead of casts.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/usb/dev-hub.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
index a6b50dbc8d..4734700e3e 100644
--- a/hw/usb/dev-hub.c
+++ b/hw/usb/dev-hub.c
@@ -350,7 +350,7 @@ static const char *feature_name(int feature)
static void usb_hub_handle_control(USBDevice *dev, USBPacket *p,
int request, int value, int index, int length, uint8_t *data)
{
- USBHubState *s = (USBHubState *)dev;
+ USBHubState *s = USB_HUB(dev);
int ret;
trace_usb_hub_control(s->dev.addr, request, value, index, length);
@@ -523,7 +523,7 @@ static void usb_hub_handle_control(USBDevice *dev, USBPacket *p,
static void usb_hub_handle_data(USBDevice *dev, USBPacket *p)
{
- USBHubState *s = (USBHubState *)dev;
+ USBHubState *s = USB_HUB(dev);
switch(p->pid) {
case USB_TOKEN_IN:
@@ -568,7 +568,7 @@ static void usb_hub_handle_data(USBDevice *dev, USBPacket *p)
static void usb_hub_unrealize(USBDevice *dev)
{
- USBHubState *s = (USBHubState *)dev;
+ USBHubState *s = USB_HUB(dev);
int i;
for (i = 0; i < s->num_ports; i++) {
--
2.38.1