diff mbox series

[9/9] hw/usb/u2f-passthru: Use QOM type-safe cast conversion macros

Message ID 20230220150515.32549-10-philmd@linaro.org
State New
Headers show
Series hw/usb: Cleanups around QOM style | expand

Commit Message

Philippe Mathieu-Daudé Feb. 20, 2023, 3:05 p.m. UTC
Use the QOM cast macros to avoid accessing internal fields.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/usb/u2f-passthru.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/hw/usb/u2f-passthru.c b/hw/usb/u2f-passthru.c
index fc93429c9c..b99c0b622f 100644
--- a/hw/usb/u2f-passthru.c
+++ b/hw/usb/u2f-passthru.c
@@ -299,7 +299,7 @@  static void u2f_passthru_recv_from_host(U2FPassthruState *key,
     if (transaction->resp_size >= transaction->resp_bcnt) {
         u2f_transaction_close(key, cid);
     }
-    u2f_send_to_guest(&key->base, packet);
+    u2f_send_to_guest(U2F_KEY(key), packet);
 }
 
 static void u2f_passthru_read(void *opaque)
@@ -316,9 +316,10 @@  static void u2f_passthru_read(void *opaque)
 
     ret = read(key->hidraw_fd, packet, sizeof(packet));
     if (ret < 0) {
+        USBDevice *udev = USB_DEVICE(key);
         /* Detach */
-        if (base->dev.attached) {
-            usb_device_detach(&base->dev);
+        if (udev->attached) {
+            usb_device_detach(udev);
             u2f_passthru_reset(key);
         }
         return;