Re: Creating URB in completion callback

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ramya Desai <ramya.desai@...>
Cc: USB list <linux-usb@...>
Date: Friday, July 3, 2009 - 3:50 pm

On Sat, 4 Jul 2009, Ramya Desai wrote:


Don't use kmalloc to allocate URBs; use usb_alloc_urb.

You must not use GFP_KERNEL in a completion routine.  Use GFP_ATOMIC 
instead.


You can't return -ENOMEM because this function returns void.


Why do the memcpy?  usb_fill_bulk_urb will just overwrite the data.


Fix those mistakes.  No other special action is needed.

In fact, you might not have to create a new URB at all.  You might be 
able to re-use the URB that was passed to 
my_usb_stor_blocking_completion().

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Creating URB in completion callback, Ramya Desai, (Fri Jul 3, 2:37 pm)
Re: Creating URB in completion callback, Alan Stern, (Fri Jul 3, 3:50 pm)
Re: Creating URB in completion callback, Ramya Desai, (Fri Jul 3, 4:19 pm)