From 43d6464d410136f1c083a6df263bb71319eb2244 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 15 Mar 2014 17:34:06 +0100 Subject: usbdump: fail early if dump file is not available This allows for less less checking by the consumer and avoids unnecessary work if the capture cannot be written anyway. Signed-off-by: Peter Wu --- hw/usb/dump.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'hw/usb/dump.h') diff --git a/hw/usb/dump.h b/hw/usb/dump.h index 1478fdc44c..08134e82e3 100644 --- a/hw/usb/dump.h +++ b/hw/usb/dump.h @@ -59,12 +59,17 @@ typedef struct UsbDumpState UsbDumpState; * direction, but setup_buf[0]. data is empty for PID == SETUP; for PID == IN, * data is of length setup_len. PID == OUT is not possible because handle_ctrl * is never called from that point. + * + * If s is NULL or if no dump file is available, no action is performed. */ void usb_dump_submit(UsbDumpState *s, USBPacket *p); + /* * complete (ctrl): setup_is irrelevant. If PID == SETUP, then the data was just * inserted by the "device" in handle_ctrl. Length is actual_length. If PID == * IN, then data is empty. PID == OUT is again not possible (see submit). + * + * If s is NULL or if no dump file is available, no action is performed. */ void usb_dump_complete(UsbDumpState *s, USBPacket *p); -- cgit v1.2.1