public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: paul.elder@ideasonboard.com
To: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: linux-usb@vger.kernel.org, balbi@kernel.org,
	laurent.pinchart@ideasonboard.com, kernel@pengutronix.de,
	caleb.connolly@ideasonboard.com
Subject: Re: [PATCH 3/7] usb: gadget: uvc: test if ep->desc is valid on ep_queue
Date: Fri, 1 Oct 2021 11:47:06 +0900	[thread overview]
Message-ID: <20211001024706.GC3032473@pyrite.rasen.tech> (raw)
In-Reply-To: <20210930102717.15720-4-m.grzeschik@pengutronix.de>

Hi Michael,

On Thu, Sep 30, 2021 at 12:27:13PM +0200, Michael Grzeschik wrote:
> The reason that the ep_queue has failed could be an disabled endpoint.

s/an/a/

> In that case it is not guaranteed that the ep->desc is still valid.
> This patch adds an check for NULL.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  drivers/usb/gadget/function/uvc_video.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
> index da93b46df464d..cdfd3726a86ae 100644
> --- a/drivers/usb/gadget/function/uvc_video.c
> +++ b/drivers/usb/gadget/function/uvc_video.c
> @@ -199,9 +199,11 @@ static int uvcg_video_ep_queue(struct uvc_video *video, struct usb_request *req)
>  		uvcg_err(&video->uvc->func, "Failed to queue request (%d).\n",
>  			 ret);
>  
> -		/* Isochronous endpoints can't be halted. */
> -		if (usb_endpoint_xfer_bulk(video->ep->desc))
> -			usb_ep_set_halt(video->ep);
> +		if (video->ep->desc) {
> +			/* Isochronous endpoints can't be halted. */
> +			if (usb_endpoint_xfer_bulk(video->ep->desc))
> +				usb_ep_set_halt(video->ep);
> +		}
>  	}
>  
>  	return ret;
> -- 
> 2.30.2
> 

  reply	other threads:[~2021-10-01  2:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 10:27 [PATCH 0/7] usb: gadget: uvc: smaller fixes for stability Michael Grzeschik
2021-09-30 10:27 ` [PATCH 1/7] usb: gadget: uvc: consistently use define for headerlen Michael Grzeschik
2021-10-01  2:36   ` paul.elder
2021-10-04 22:08   ` Laurent Pinchart
2021-09-30 10:27 ` [PATCH 2/7] usb: gadget: uvc: rename function to be more consistent Michael Grzeschik
2021-10-01  2:41   ` paul.elder
2021-10-04 22:13   ` Laurent Pinchart
2021-09-30 10:27 ` [PATCH 3/7] usb: gadget: uvc: test if ep->desc is valid on ep_queue Michael Grzeschik
2021-10-01  2:47   ` paul.elder [this message]
2021-10-04 22:15   ` Laurent Pinchart
2021-09-30 10:27 ` [PATCH 4/7] usb: gadget: uvc: only schedule stream in streaming state Michael Grzeschik
2021-10-01  2:54   ` paul.elder
2021-10-04 22:21   ` Laurent Pinchart
2021-09-30 10:27 ` [PATCH 5/7] usb: gadget: uvc: only pump video data if necessary Michael Grzeschik
2021-10-01  3:03   ` paul.elder
2021-10-04 22:29   ` Laurent Pinchart
2021-10-17 21:11     ` Michael Grzeschik
2021-09-30 10:27 ` [PATCH 6/7] usb: gadget: uvc: ensure the vdev is unset Michael Grzeschik
2021-10-01  3:07   ` paul.elder
2021-10-04 22:31   ` Laurent Pinchart
2021-09-30 10:27 ` [PATCH 7/7] usb: gadget: udc: ensure the gadget is still available Michael Grzeschik
2021-10-04 22:41   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211001024706.GC3032473@pyrite.rasen.tech \
    --to=paul.elder@ideasonboard.com \
    --cc=balbi@kernel.org \
    --cc=caleb.connolly@ideasonboard.com \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox