Skip to content

Commit

Permalink
usb: host: fotg210: fix the actual_length of an iso packet
Browse files Browse the repository at this point in the history
[ Upstream commit 091cb2f ]

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>
  • Loading branch information
Kelly Devilliv authored and gregkh committed Sep 18, 2021
1 parent 326a86a commit e98b793
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 2 additions & 3 deletions drivers/usb/host/fotg210-hcd.c
Expand Up @@ -4460,13 +4460,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 */
Expand Down
5 changes: 0 additions & 5 deletions drivers/usb/host/fotg210.h
Expand Up @@ -683,11 +683,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 */

0 comments on commit e98b793

Please sign in to comment.