On Fri, Dec 25, 2015 at 09:50:50AM +0100, Oliver Neukum wrote:
> > + ret = usbfs_increase_memory_usage(size + sizeof(struct usb_memory));
> > + if (ret) {
> > + module_put(THIS_MODULE);
> > + return ret;
> > + }
>
> Could you do the error handling in a unified manner with "goto"?
Yes and no. I couldn't do it fully unified; note the error path below that
uses usbfs_decrease_memory_usage() instead. I could do it sort-of-unified,
but it ended up being one of those label cascades, of course:
return 0;
error_free_usbm:
kfree(usbm);
error_decrease_mem:
usbfs_decrease_memory_usage(size + sizeof(struct usb_memory));
error_module_put:
module_put(THIS_MODULE);
return ret;
> > + mem = usb_alloc_coherent(ps->dev, size, GFP_KERNEL, &dma_handle);
> Shouldn't this be GFP_USER to let limits apply?
This I don't really know anything about. Alan?
/* Steinar */
--
Software Engineer, Google Switzerland
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html