diff --git a/hw/usb/core.c b/hw/usb/core.c
index bfb7ae67bbf0204b7b6fe74faa226ef89c83c318..8fbd9c7d573b37e4a9e867a8d4b5c8c66122460c 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -717,9 +717,7 @@ struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep)
 {
     struct USBEndpoint *eps;
 
-    if (dev == NULL) {
-        return NULL;
-    }
+    assert(dev != NULL);
     if (ep == 0) {
         return &dev->ep_ctl;
     }