summaryrefslogtreecommitdiff
path: root/hw/usb/dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/usb/dump.c')
-rw-r--r--hw/usb/dump.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/usb/dump.c b/hw/usb/dump.c
index 48da328126..eb4ce336e4 100644
--- a/hw/usb/dump.c
+++ b/hw/usb/dump.c
@@ -266,7 +266,10 @@ void usb_dump_submit(UsbDumpState *s, USBPacket *p)
uint8_t pid = p->pid;
uint8_t ep_type = p->ep->type;
- assert(s != NULL);
+ /* fail early if not configured */
+ if (!s || s->fd < 0) {
+ return;
+ }
if (ep_type == USB_ENDPOINT_XFER_CONTROL) {
// cannot get called for OUT
@@ -294,7 +297,10 @@ void usb_dump_complete(UsbDumpState *s, USBPacket *p)
uint8_t pid = p->pid;
uint8_t ep_type = p->ep->type;
- assert(s != NULL);
+ /* fail early if not configured */
+ if (!s || s->fd < 0) {
+ return;
+ }
if (ep_type == USB_ENDPOINT_XFER_CONTROL) {
assert(pid == USB_TOKEN_IN || pid == USB_TOKEN_SETUP);