Skip to content

Commit

Permalink
hpm_ehci: fix transfer cancellation process.
Browse files Browse the repository at this point in the history
The logic of the conditional expression that determines whether
the QH is a target QH or not is reversed in the process of canceling
a transfer in INPROGRESS state.

Therefore, the QH in INPROGRESS state is not released and subsequent
communication is not successful.

Checked with CDC-ACM driver and cu command.

Signed-off-by: Zhihong Chen <[email protected]>
  • Loading branch information
chenzhihong007 committed Jun 28, 2024
1 parent 030c2fe commit 313dadd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions arch/risc-v/src/hpmicro/hpm_ehci.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ struct hpm_rhport_s
/* Root hub port status */

volatile bool connected; /* Connected to device */
volatile bool lowspeed; /* Low speed device attached */
struct hpm_epinfo_s ep0; /* EP0 endpoint info */
struct hpm_epinfo_s ep0; /* EP0 endpoint info */

/* This is the hub port description understood by class drivers */

Expand Down Expand Up @@ -3013,7 +3012,7 @@ static int hpm_qh_cancel(struct hpm_qh_s *qh, uint32_t **bp, void *arg)

/* Check if this is the QH that we are looking for */

if (qh->epinfo == epinfo)
if (qh->epinfo != epinfo)
{
/* No... keep looking */

Expand Down Expand Up @@ -3237,7 +3236,6 @@ static inline void hpm_portsc_bottomhalf(void)
rhpndx + 1, g_ehci.pscwait);

rhport->connected = false;
rhport->lowspeed = false;

/* Are we bound to a class instance? */

Expand Down Expand Up @@ -4735,7 +4733,7 @@ static int hpm_cancel(struct usbhost_driver_s *drvr, usbhost_ep_t ep)
* head.
*/

if (qh && qh != &g_asynchead)
if (qh && qh == &g_asynchead)
{
/* Claim that we successfully cancelled the transfer */

Expand Down

0 comments on commit 313dadd

Please sign in to comment.