Commit 41dc9ac1 authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Felipe Balbi

usb: gadget: f_fs: Accept up to 30 endpoints.

It is allowed by the USB specification to enabled same-address, opposite-
direction endpoints simultaneously, which means 30 non-zero endpoints
are allowed. So double eps_addrmap length to 30.
The original code only accepted 14 descriptors out of a likely intended 15
(as there are 15 endpoint addresses, ignoring direction), because the first
eps_addrmap entry is unused (it is a placeholder for endpoint zero). So
increase eps_addrmap length by one to 31.
Signed-off-by: default avatarVincent Pelletier <plr.vincent@gmail.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent f199a80c
...@@ -2101,7 +2101,7 @@ static int __ffs_data_do_entity(enum ffs_entity_type type, ...@@ -2101,7 +2101,7 @@ static int __ffs_data_do_entity(enum ffs_entity_type type,
case FFS_ENDPOINT: case FFS_ENDPOINT:
d = (void *)desc; d = (void *)desc;
helper->eps_count++; helper->eps_count++;
if (helper->eps_count >= 15) if (helper->eps_count >= FFS_MAX_EPS_COUNT)
return -EINVAL; return -EINVAL;
/* Check if descriptors for any speed were already parsed */ /* Check if descriptors for any speed were already parsed */
if (!helper->ffs->eps_count && !helper->ffs->interfaces_count) if (!helper->ffs->eps_count && !helper->ffs->interfaces_count)
......
...@@ -247,7 +247,8 @@ struct ffs_data { ...@@ -247,7 +247,8 @@ struct ffs_data {
unsigned user_flags; unsigned user_flags;
u8 eps_addrmap[15]; #define FFS_MAX_EPS_COUNT 31
u8 eps_addrmap[FFS_MAX_EPS_COUNT];
unsigned short strings_count; unsigned short strings_count;
unsigned short interfaces_count; unsigned short interfaces_count;
......
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