Re: chipidea: udc: kernel panic in isr_setup_status_phase

From: Clemens Gruber
Date: Mon Sep 05 2016 - 13:24:26 EST


On Mon, Sep 05, 2016 at 11:10:22AM +0800, Peter Chen wrote:
> How about below, it will set halt for device, and host will get stall
> from the device.
>
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index 0f692fc..3c46ccb 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -946,6 +946,11 @@ static int isr_setup_status_phase(struct ci_hdrc *ci)
> int retval;
> struct ci_hw_ep *hwep;
>
> + if (!ci->status) {
> + WARN_ON(1);
> + return -EPIPE;
> + }
> +
> hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in;
> ci->status->context = ci;
> ci->status->complete = isr_setup_status_complete;
>

Returning -EPIPE works! I would however suggest to only warn once, as
this otherwise floods the kernel log.

I'll send a patch shortly, also adding a comment for people experiencing
a similar hardware problem.

Thank you very much for your help, Peter!

Regards,
Clemens