diff mbox

host-libusb: Correct test for USB packet state

Message ID 1367935572-15501-1-git-send-email-emaste@freebsd.org
State New
Headers show

Commit Message

Ed Maste May 7, 2013, 2:06 p.m. UTC
USB_RET_ASYNC is -6, so inflight was always false.

Signed-off-by: Ed Maste <emaste@freebsd.org>
---
 hw/usb/host-libusb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ed Maste May 21, 2013, 1:45 p.m. UTC | #1
On 7 May 2013 10:06, Ed Maste <emaste@freebsd.org> wrote:
> USB_RET_ASYNC is -6, so inflight was always false.

Ping.  I believe the "if (inflight)" block in usb_host_req_abort() can
never be executed in the current code.

> Signed-off-by: Ed Maste <emaste@freebsd.org>
> ---
>  hw/usb/host-libusb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
> index d1186b8..0af6ce3 100644
> --- a/hw/usb/host-libusb.c
> +++ b/hw/usb/host-libusb.c
> @@ -384,7 +384,7 @@ out:
>  static void usb_host_req_abort(USBHostRequest *r)
>  {
>      USBHostDevice  *s = r->host;
> -    bool inflight = (r->p && r->p->state == USB_RET_ASYNC);
> +    bool inflight = (r->p && r->p->state == USB_PACKET_ASYNC);
>
>      if (inflight) {
>          r->p->status = USB_RET_NODEV;
> --
> 1.7.11.5
Gerd Hoffmann May 28, 2013, 10:50 a.m. UTC | #2
On 05/21/13 15:45, Ed Maste wrote:
> On 7 May 2013 10:06, Ed Maste <emaste@freebsd.org> wrote:
>> USB_RET_ASYNC is -6, so inflight was always false.
> 
> Ping.  I believe the "if (inflight)" block in usb_host_req_abort() can
> never be executed in the current code.

Patch added to usb patch queue.

thanks,
  Gerd
diff mbox

Patch

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index d1186b8..0af6ce3 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -384,7 +384,7 @@  out:
 static void usb_host_req_abort(USBHostRequest *r)
 {
     USBHostDevice  *s = r->host;
-    bool inflight = (r->p && r->p->state == USB_RET_ASYNC);
+    bool inflight = (r->p && r->p->state == USB_PACKET_ASYNC);
 
     if (inflight) {
         r->p->status = USB_RET_NODEV;