Re: [PATCH] usb: image: mdc800: kill download URB on timeout

From: Ziyi Guo

Date: Mon Feb 09 2026 - 10:08:30 EST


On Mon, Feb 9, 2026 at 8:44 AM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
>
> This code is not correct because it doesn't check to see whether the URB
> completed normally or timed out. The usb_kill_urb() call should not be
> issued if the URB completed normally.
>
> Also, the code should not access mdc800->download_urb->status until
> after the URB completes. The code should be structured like this:
>
> retval = wait_event_timeout(mdc800->download_wait,
> mdc800->downloaded,
> msecs_to_jiffies(TO_DOWNLOAD_GET_READY));
> if (!retval)
> usb_kill_urb(mdc800->download_urb);
> mdc800->downloaded = 0;
> if (mdc800->download_urb->status != 0) {
> ...
>
> Alan Stern

Hi Alan,

Thanks for your time and review, I'll revise the code and send a v2
version patch.