mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
usb: gadget: ffs: fix enable multiple instances
This patch fixes an "off-by-one" bug found in
581791f
(FunctionFS: enable multiple functions).
During gfs_bind/gfs_unbind the functionfs_bind/functionfs_unbind should be
called for every functionfs instance. With the "i" pre-decremented they
were not called for the zeroth instance.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: <stable@vger.kernel.org>
[ balbi@ti.com : added offending commit's subject ]
Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: Idf19c2d3842546fb0fb47f77f59a248b1caa3fcb
This commit is contained in:
parent
3e34c77b60
commit
01935051eb
1 changed files with 2 additions and 2 deletions
|
@ -358,7 +358,7 @@ static int gfs_bind(struct usb_composite_dev *cdev)
|
|||
if (unlikely(ret < 0))
|
||||
goto error;
|
||||
|
||||
for (i = func_num; --i; ) {
|
||||
for (i = func_num; i--; ) {
|
||||
ret = functionfs_bind(ffs_tab[i].ffs_data, cdev);
|
||||
if (unlikely(ret < 0)) {
|
||||
while (++i < func_num)
|
||||
|
@ -413,7 +413,7 @@ static int gfs_unbind(struct usb_composite_dev *cdev)
|
|||
gether_cleanup();
|
||||
gfs_ether_setup = false;
|
||||
|
||||
for (i = func_num; --i; )
|
||||
for (i = func_num; i--; )
|
||||
if (ffs_tab[i].ffs_data)
|
||||
functionfs_unbind(ffs_tab[i].ffs_data);
|
||||
|
||||
|
|
Loading…
Reference in a new issue