提交 25fbf96b 编写于 作者: S Stephen Warren 提交者: Lukasz Majewski

USB: gadget: save driver name before registering it

g_dnl_register() currently first attempts to register a composite
driver by name, and then saves the driver name once it's registered.
Internally to the registration code, g_dnl_do_config() is called and
attempts to compare the composite device's name with the list of known
device names. This fails since the composite device's name has not yet
been stored. This means that the first time "ums 0 0" is run, it fails,
but subsequent attempts succeed.

Re-order the name-saving and registration code to solve this.

Fixes: e5b834e07f51 ("USB: gadget: added a saner gadget downloader registration API")
Signed-off-by: NStephen Warren <swarren@nvidia.com>
上级 c4d0e856
...@@ -245,11 +245,12 @@ static struct usb_composite_driver g_dnl_driver = { ...@@ -245,11 +245,12 @@ static struct usb_composite_driver g_dnl_driver = {
*/ */
int g_dnl_register(const char *name) int g_dnl_register(const char *name)
{ {
int ret = usb_composite_register(&g_dnl_driver); int ret;
debug("%s: g_dnl_driver.name = %s\n", __func__, name); debug("%s: g_dnl_driver.name = %s\n", __func__, name);
g_dnl_driver.name = name; g_dnl_driver.name = name;
ret = usb_composite_register(&g_dnl_driver);
if (ret) { if (ret) {
printf("%s: failed!, error: %d\n", __func__, ret); printf("%s: failed!, error: %d\n", __func__, ret);
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册