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>
This commit is contained in:
Gerd Hoffmann 2012-01-10 17:33:02 +01:00
parent 06c750888c
commit 98861f512b

View File

@ -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) {