On Wed, 16 May 2007, Hans Petter Selasky wrote: > It is very clear to me that non-blocking memory allocation at the point of > starting an USB transfer will require extra error handling in the USB device > driver code!
It's not so clear to me. > My "usbd_transfer_start()" returns "void". Your "usb_submit_urb()" > returns "int". URB submission has other failure possibilities than lack of memory. Those other things have to be checked for regardless. > Pre-allocating everything you need simply saves code, hence you only check > once if you got the memory or not. It doesn't save code. You need to check for the memory when you allocate it, no matter when that is done. One allocation = one check. The total code size is the same if you do the allocation early and only once or if you do it late and many times. It does save execution time. But that's a different matter; it also wastes data space. Alan Stern ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel