diff options
| author | Gerd Hoffmann <kraxel@redhat.com> | 2012-01-10 17:33:02 +0100 |
|---|---|---|
| committer | Gerd Hoffmann <kraxel@redhat.com> | 2012-02-10 11:31:57 +0100 |
| commit | 98861f512bbd8789bd7935a75316d3278be23a0a (patch) | |
| tree | a5f798a6742f9df2f2e158f7446e77a6a0fbbd96 /hw/usb.c | |
| parent | 06c750888c57bdc374feaa097f6cbc720210b834 (diff) | |
| download | focaccia-qemu-98861f512bbd8789bd7935a75316d3278be23a0a.tar.gz focaccia-qemu-98861f512bbd8789bd7935a75316d3278be23a0a.zip | |
usb: handle dev == NULL in usb_handle_packet()
Allow passing in a NULL pointer, return USB_RET_NODEV in that case. Removes the burden to to a NULL pointer check from the callers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb.c')
| -rw-r--r-- | hw/usb.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/usb.c b/hw/usb.c index bacdc81bfc..9976f81bd7 100644 --- a/hw/usb.c +++ b/hw/usb.c @@ -315,6 +315,10 @@ int usb_handle_packet(USBDevice *dev, USBPacket *p) { int ret; + if (dev == NULL) { + return USB_RET_NODEV; + } + assert(p->owner == NULL); ret = usb_device_handle_packet(dev, p); if (ret == USB_RET_ASYNC) { |