When matching tx fifo to endpoint, consider all fifos instead of
hard limiting to 8
Moreover, print error in case no fifo could be found.

Signed-off-by: Mian Yousaf Kaukab <yousaf.kau...@intel.com>
---
 drivers/usb/dwc2/gadget.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index d6a0a6e..28d830b 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2547,7 +2547,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
         */
        if (dir_in && hsotg->dedicated_fifos) {
                size = hs_ep->ep.maxpacket*hs_ep->mc;
-               for (i = 1; i <= 8; ++i) {
+               for (i = 1; i < hsotg->num_of_eps; ++i) {
                        if (hsotg->fifo_map & (1<<i))
                                continue;
                        val = readl(hsotg->regs + DPTXFSIZN(i));
@@ -2561,7 +2561,9 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep,
                        hs_ep->fifo_size = val;
                        break;
                }
-               if (i == 8) {
+               if (i == hsotg->num_of_eps) {
+                       dev_err(hsotg->dev,
+                               "%s: No suitable fifo found\n", __func__);
                        ret = -ENOMEM;
                        goto error;
                }
-- 
1.9.1

----------------------------------------------------------------------
Intel Sweden AB
Registered Office: Knarrarnasgatan 15, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to