Commit fea77077 authored by Wei Yongjun's avatar Wei Yongjun Committed by Felipe Balbi

usb: gadget: fix error return code in configfs_composite_bind()

Fix to return a negative error code in the go through all configs error
handling case instead of 0(usb_add_function() will overwrite ret to 0).
Also use error code from usb_gstrings_attach() in all strings init error
case instead of -EINVAL.
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 481d3042
...@@ -821,8 +821,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget, ...@@ -821,8 +821,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
gi->gstrings[i] = NULL; gi->gstrings[i] = NULL;
s = usb_gstrings_attach(&gi->cdev, gi->gstrings, s = usb_gstrings_attach(&gi->cdev, gi->gstrings,
USB_GADGET_FIRST_AVAIL_IDX); USB_GADGET_FIRST_AVAIL_IDX);
if (IS_ERR(s)) if (IS_ERR(s)) {
ret = PTR_ERR(s);
goto err_comp_cleanup; goto err_comp_cleanup;
}
gi->cdev.desc.iManufacturer = s[USB_GADGET_MANUFACTURER_IDX].id; gi->cdev.desc.iManufacturer = s[USB_GADGET_MANUFACTURER_IDX].id;
gi->cdev.desc.iProduct = s[USB_GADGET_PRODUCT_IDX].id; gi->cdev.desc.iProduct = s[USB_GADGET_PRODUCT_IDX].id;
...@@ -847,8 +849,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget, ...@@ -847,8 +849,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
} }
cfg->gstrings[i] = NULL; cfg->gstrings[i] = NULL;
s = usb_gstrings_attach(&gi->cdev, cfg->gstrings, 1); s = usb_gstrings_attach(&gi->cdev, cfg->gstrings, 1);
if (IS_ERR(s)) if (IS_ERR(s)) {
ret = PTR_ERR(s);
goto err_comp_cleanup; goto err_comp_cleanup;
}
c->iConfiguration = s[0].id; c->iConfiguration = s[0].id;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment