On Fri, Mar 01, 2013 at 03:42:26PM +0100, Michael Grzeschik wrote: > Instead of having a limited number of usable tds in the udc we use a > linked list to support dynamic amount of needed tds for all special > gadget types. This improves throughput. > > This patch also adresses a possible momory leak in _ep_nuke found > while porting the request handling to an linked list. > > - The call of _ep_nuke can lead to an memory leak, if it is called on an > endpoint with currently dynamic allocated tds. This was aswell a problem > in the special case before the dynamic td handling was implemented and > an zero length packet was added to mark the end of the transfer. It is another problem, better have another commit, besides, can you describe more detail? > + > +static int add_td_to_list(struct ci13xxx_ep *mEp, struct ci13xxx_req *mReq, unsigned length) > +{ > + struct td_node *lastnode, *node = kzalloc(sizeof(struct td_node), GFP_ATOMIC); Better split above one line to two lines like below "dma_pool_alloc" > + > + if (node == NULL) > + return -ENOMEM; > + > + node->ptr = dma_pool_alloc(mEp->td_pool, GFP_ATOMIC, > + &node->dma); > + if (node->ptr == NULL) { > + kfree(node); > + return -ENOMEM; > + } > + > + setup_td_bits(node, length); > + > + /* get the last entry */ > + lastnode = list_entry(mReq->tds.prev, > + struct td_node, td); > + lastnode->ptr->next = node->dma; > + > + INIT_LIST_HEAD(&node->td); > + list_add_tail(&node->td, &mReq->tds); > + > + return 0; > +} > + > /** -- Best Regards, Peter Chen -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html