qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 09/28] usb: handle dev == NULL in usb_handle_packet(


From: Gerd Hoffmann
Subject: [Qemu-devel] [PATCH 09/28] usb: handle dev == NULL in usb_handle_packet()
Date: Fri, 10 Feb 2012 12:43:05 +0100

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 <address@hidden>
---
 hw/usb.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/hw/usb.c b/hw/usb.c
index bacdc81..9976f81 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) {
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]