2023-05-04 00:42:21

by Roy Luo

[permalink] [raw]
Subject: [PATCH v2] usb: dwc3: Add error logs for unknown endpoint events

In cases where the controller somehow fails to write to event buffer
memory (e.g. due to incorrect MMU config), the driver would receive
all-zero dwc3 events. However, the abnormal event is silently dropped
as a regular ep0out event.
Add error logs when an unknown endpoint event is received to highlight
the anomaly.

Signed-off-by: Roy Luo <[email protected]>
---
drivers/usb/dwc3/ep0.c | 3 +++
drivers/usb/dwc3/gadget.c | 3 +++
2 files changed, 6 insertions(+)

diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 953b752a5052..b94243237293 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -1207,5 +1207,8 @@ void dwc3_ep0_interrupt(struct dwc3 *dwc,
dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
}
break;
+ default:
+ dev_err(dwc->dev, "unknown endpoint event %d\n", event->endpoint_event);
+ break;
}
}
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index c0ca4d12f95d..7163d5d0eea0 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -3803,6 +3803,9 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
break;
case DWC3_DEPEVT_RXTXFIFOEVT:
break;
+ default:
+ dev_err(dwc->dev, "unknown endpoint event %d\n", event->endpoint_event);
+ break;
}
}


base-commit: c8c655c34e33544aec9d64b660872ab33c29b5f1
--
2.40.1.495.gc816e09b53d-goog


2023-05-04 22:15:12

by Thinh Nguyen

[permalink] [raw]
Subject: Re: [PATCH v2] usb: dwc3: Add error logs for unknown endpoint events

On Thu, May 04, 2023, Roy Luo wrote:
> In cases where the controller somehow fails to write to event buffer
> memory (e.g. due to incorrect MMU config), the driver would receive
> all-zero dwc3 events. However, the abnormal event is silently dropped
> as a regular ep0out event.
> Add error logs when an unknown endpoint event is received to highlight
> the anomaly.
>
> Signed-off-by: Roy Luo <[email protected]>
> ---
> drivers/usb/dwc3/ep0.c | 3 +++
> drivers/usb/dwc3/gadget.c | 3 +++
> 2 files changed, 6 insertions(+)
>
> diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
> index 953b752a5052..b94243237293 100644
> --- a/drivers/usb/dwc3/ep0.c
> +++ b/drivers/usb/dwc3/ep0.c
> @@ -1207,5 +1207,8 @@ void dwc3_ep0_interrupt(struct dwc3 *dwc,
> dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
> }
> break;
> + default:
> + dev_err(dwc->dev, "unknown endpoint event %d\n", event->endpoint_event);
> + break;
> }
> }
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index c0ca4d12f95d..7163d5d0eea0 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -3803,6 +3803,9 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
> break;
> case DWC3_DEPEVT_RXTXFIFOEVT:
> break;
> + default:
> + dev_err(dwc->dev, "unknown endpoint event %d\n", event->endpoint_event);
> + break;
> }
> }
>
>
> base-commit: c8c655c34e33544aec9d64b660872ab33c29b5f1
> --
> 2.40.1.495.gc816e09b53d-goog
>

Acked-by: Thinh Nguyen <[email protected]>

Thanks,
Thinh