@samitouri / QOSamiQemu / commits / e49f46d5c4

hw/usb/core.c: reorder usage and assertion of p->ep

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>

Sergei Heifetz committed Feb 8, 2026 at 15:39 UTC e49f46d5c4b5bfbffe6b19bf66a8a9463e248003
1 file changed +1 -1
hw/usb/core.c
+1 -1
@@ -423,10 +423,10 @@ void usb_handle_packet(USBDevice *dev, USBPacket *p)
423 p->status = USB_RET_NODEV;
424 return;
425 }
426 + assert(p->ep);
427 assert(dev == p->ep->dev);
428 assert(dev->state == USB_STATE_DEFAULT);
429 usb_packet_check_state(p, USB_PACKET_SETUP);
429 - assert(p->ep != NULL);
430
431 /* Submitting a new packet clears halt */
432 if (p->ep->halted) {