]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: host: fotg210: fix the actual_length of an iso packet
authorKelly Devilliv <kelly.devilliv@gmail.com>
Sun, 27 Jun 2021 12:57:47 +0000 (20:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:42:01 +0000 (13:42 +0200)
[ Upstream commit 091cb2f782f32ab68c6f5f326d7868683d3d4875 ]

We should acquire the actual_length of an iso packet
from the iTD directly using FOTG210_ITD_LENGTH() macro.

Signed-off-by: Kelly Devilliv <kelly.devilliv@gmail.com>
Link: https://lore.kernel.org/r/20210627125747.127646-4-kelly.devilliv@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/host/fotg210-hcd.c
drivers/usb/host/fotg210.h

index 3b5d185c108a390903f2443ae5ff0c9683482d5e..670a2fecc9c775b89a1c8c283e4c2d6064f3a57f 100644 (file)
@@ -4459,13 +4459,12 @@ static bool itd_complete(struct fotg210_hcd *fotg210, struct fotg210_itd *itd)
 
                        /* HC need not update length with this error */
                        if (!(t & FOTG210_ISOC_BABBLE)) {
-                               desc->actual_length =
-                                       fotg210_itdlen(urb, desc, t);
+                               desc->actual_length = FOTG210_ITD_LENGTH(t);
                                urb->actual_length += desc->actual_length;
                        }
                } else if (likely((t & FOTG210_ISOC_ACTIVE) == 0)) {
                        desc->status = 0;
-                       desc->actual_length = fotg210_itdlen(urb, desc, t);
+                       desc->actual_length = FOTG210_ITD_LENGTH(t);
                        urb->actual_length += desc->actual_length;
                } else {
                        /* URB was too late */
index 6cee40ec65b4140b0a1352b7b7a8405e8c6889db..67f59517ebadea5f6994addff64950b6cbde68bf 100644 (file)
@@ -686,11 +686,6 @@ static inline unsigned fotg210_read_frame_index(struct fotg210_hcd *fotg210)
        return fotg210_readl(fotg210, &fotg210->regs->frame_index);
 }
 
-#define fotg210_itdlen(urb, desc, t) ({                        \
-       usb_pipein((urb)->pipe) ?                               \
-       (desc)->length - FOTG210_ITD_LENGTH(t) :                        \
-       FOTG210_ITD_LENGTH(t);                                  \
-})
 /*-------------------------------------------------------------------------*/
 
 #endif /* __LINUX_FOTG210_H */