]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/usb/core.c: reorder usage and assertion of p->ep
authorSergei Heifetz <heifetz@yandex-team.com>
Sun, 8 Feb 2026 10:39:58 +0000 (15:39 +0500)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 16 Mar 2026 10:50:17 +0000 (13:50 +0300)
Reorder the code so the assertion of p->ep occurs before it is
used in the subsequent lines.

Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/usb/core.c

index b3f811c513b58cb2c3cc8aebf01bf931bd0260d1..9572a870cc0e90c458ac0cf4881413c6eb5b57a5 100644 (file)
@@ -423,10 +423,10 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p)
         p->status = USB_RET_NODEV;
         return;
     }
+    assert(p->ep);
     assert(dev == p->ep->dev);
     assert(dev->state == USB_STATE_DEFAULT);
     usb_packet_check_state(p, USB_PACKET_SETUP);
-    assert(p->ep != NULL);
 
     /* Submitting a new packet clears halt */
     if (p->ep->halted) {