usb: renesas_usbhs: care usb_hcd_giveback_urb() status
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Fri, 9 Dec 2011 02:31:11 +0000 (18:31 -0800)
committerFelipe Balbi <balbi@ti.com>
Tue, 13 Dec 2011 11:06:29 +0000 (13:06 +0200)
Without this patch, USB host hub shows error when cable was detached

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/renesas_usbhs/mod_host.c

index 28b2cb3a029a5e3ca8e8ac741a25575b9352895c..9715a701373460f48986168b701da1c2932be207 100644 (file)
@@ -635,6 +635,7 @@ static void usbhsh_queue_done(struct usbhs_priv *priv, struct usbhs_pkt *pkt)
        struct urb *urb = ureq->urb;
        struct usbhsh_ep *uep = usbhsh_ep_to_uep(urb->ep);
        struct device *dev = usbhs_priv_to_dev(priv);
+       int status = 0;
 
        dev_dbg(dev, "%s\n", __func__);
 
@@ -643,6 +644,9 @@ static void usbhsh_queue_done(struct usbhs_priv *priv, struct usbhs_pkt *pkt)
                return;
        }
 
+       if (!usbhsh_is_running(hpriv))
+               status = -ESHUTDOWN;
+
        urb->actual_length = pkt->actual;
        usbhsh_ureq_free(hpriv, ureq);
 
@@ -650,7 +654,7 @@ static void usbhsh_queue_done(struct usbhs_priv *priv, struct usbhs_pkt *pkt)
        usbhsh_pipe_detach(hpriv, uep);
 
        usb_hcd_unlink_urb_from_ep(hcd, urb);
-       usb_hcd_giveback_urb(hcd, urb, 0);
+       usb_hcd_giveback_urb(hcd, urb, status);
 }
 
 static int usbhsh_queue_push(struct usb_hcd *hcd,