diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2013-05-07 07:50:31 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-05-15 10:25:49 -0400 |
commit | fea77077d1623c6a8d586266cf55c2289360bea3 (patch) | |
tree | 0cdef3493a851372e67e599cabfb5a8db0e9236b | |
parent | 481d30427e5506fc1f5c27bbb94faef9d1ec72a0 (diff) |
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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/gadget/configfs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 3d5cfc9c2c78..80e7f75a56c7 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c | |||
@@ -821,8 +821,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget, | |||
821 | gi->gstrings[i] = NULL; | 821 | gi->gstrings[i] = NULL; |
822 | s = usb_gstrings_attach(&gi->cdev, gi->gstrings, | 822 | s = usb_gstrings_attach(&gi->cdev, gi->gstrings, |
823 | USB_GADGET_FIRST_AVAIL_IDX); | 823 | USB_GADGET_FIRST_AVAIL_IDX); |
824 | if (IS_ERR(s)) | 824 | if (IS_ERR(s)) { |
825 | ret = PTR_ERR(s); | ||
825 | goto err_comp_cleanup; | 826 | goto err_comp_cleanup; |
827 | } | ||
826 | 828 | ||
827 | gi->cdev.desc.iManufacturer = s[USB_GADGET_MANUFACTURER_IDX].id; | 829 | gi->cdev.desc.iManufacturer = s[USB_GADGET_MANUFACTURER_IDX].id; |
828 | gi->cdev.desc.iProduct = s[USB_GADGET_PRODUCT_IDX].id; | 830 | gi->cdev.desc.iProduct = s[USB_GADGET_PRODUCT_IDX].id; |
@@ -847,8 +849,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget, | |||
847 | } | 849 | } |
848 | cfg->gstrings[i] = NULL; | 850 | cfg->gstrings[i] = NULL; |
849 | s = usb_gstrings_attach(&gi->cdev, cfg->gstrings, 1); | 851 | s = usb_gstrings_attach(&gi->cdev, cfg->gstrings, 1); |
850 | if (IS_ERR(s)) | 852 | if (IS_ERR(s)) { |
853 | ret = PTR_ERR(s); | ||
851 | goto err_comp_cleanup; | 854 | goto err_comp_cleanup; |
855 | } | ||
852 | c->iConfiguration = s[0].id; | 856 | c->iConfiguration = s[0].id; |
853 | } | 857 | } |
854 | 858 | ||