* Andrzej Pietrasiewicz | 2012-10-18 13:17:18 [+0200]: >Hello Sebastian, Hi Andrzej, >Thank you for the patches. By no means am I questioning your work; >I have a question, though. Please see inline. Feel free to question my work. If you have a better idea of doing something, feel free to bring it up. >On Wednesday, October 17, 2012 9:07 PM Sebastian Andrzej Siewior wrote: >and, in consequence, usb_get_function returns -ENOMEM. >Which is the hint to the caller that there is no need to call >usb_put_function. And so the module refcount remains increased. This should not happen, I should have put the module. >Even if the caller did call usb_put_function, the uf->mod >is not set anyway, so module_put() is not called. > >Am I missing something? No, thanks for the hint. So with this in my tree | { | struct usb_d_function *f; | struct usb_function *uf; | | mutex_lock(&func_lock); | list_for_each_entry(f, &func_list, list) { | if (!strcmp(name, f->name)) { | bool ok; | ok = try_module_get(f->mod); | uf = ERR_PTR(-EBUSY); | if (!ok) | goto out; | uf = f->alloc(); | if (uf) { | uf->mod = f->mod; | } else { | module_put(f->mod); | uf = ERR_PTR(-ENOMEM); | } | mutex_unlock(&func_lock); | return uf; | } | } | uf = ERR_PTR(-ENOENT); | out: | mutex_unlock(&func_lock); | return uf; | } it should be fine, right? >Thanks, > >AP Sebastian -- 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