On Thu, Nov 22, 2012 at 6:50 PM, naveen yadav <yad.nav...@gmail.com> wrote:
> urb_count is incremented at only one place in usb_hcd_submit_urb() and
> decremented in usb_hcd_giveback_urb(). (Also, in error case inside
> usb_hcd_submit_urb()). After taking print of  urb->use_count at all
Hi Alan ,

In function usb_hcd_giveback_urb() , urb completion handler is called
first followed by decrement of
urb->use_count as follow :
usb_hcd_giveback_urb(){
...
urb->complete (urb);
atomic_dec (&urb->use_count);
...
}

In urb completion handler , urb is re-submitted , so urb->use_count is
incremented to a value of 2 first and then usb_hcd_giveback_urb
reduces urb->use_count to 1 . As urb processing is complete by the
time urb->complete()
is called , I think urb->use_count should be decremented first
followed by urb completion handler call as below :-

usb_hcd_giveback_urb(){
...
atomic_dec (&urb->use_count);
urb->complete (urb);
...
}

Please let me know if i am missing something .

Thanks,
Amit Nagal
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to