linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: stk1160: Restore deleted comment in stk1160_fill_urb()
@ 2025-07-15 23:00 Dan Carpenter
  2025-07-21  5:02 ` Xu Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-07-15 23:00 UTC (permalink / raw)
  To: Xu Yang
  Cc: Ezequiel Garcia, Mauro Carvalho Chehab, linux-media, linux-kernel,
	kernel-janitors

This comment explains why we return success when usb_alloc_noncoherent()
fails and I think it's helpful.  It was deleted during a recent refactor,
but let's add it back.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/media/usb/stk1160/stk1160-video.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c
index 416cb74377eb..3e6bffd49346 100644
--- a/drivers/media/usb/stk1160/stk1160-video.c
+++ b/drivers/media/usb/stk1160/stk1160-video.c
@@ -408,8 +408,13 @@ static int stk1160_fill_urb(struct stk1160 *dev, struct stk1160_urb *stk_urb,
 	stk_urb->transfer_buffer = usb_alloc_noncoherent(dev->udev, sb_size,
 							 GFP_KERNEL, &stk_urb->dma,
 							 DMA_FROM_DEVICE, &stk_urb->sgt);
-	if (!stk_urb->transfer_buffer)
+	if (!stk_urb->transfer_buffer) {
+		/*
+		 * If the buffer allocation failed, we exit but return 0 since
+		 * we allow the driver working with less buffers.
+		 */
 		goto free_urb;
+	}
 
 	stk_urb->dev = dev;
 	return 0;
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: stk1160: Restore deleted comment in stk1160_fill_urb()
  2025-07-15 23:00 [PATCH] media: stk1160: Restore deleted comment in stk1160_fill_urb() Dan Carpenter
@ 2025-07-21  5:02 ` Xu Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Xu Yang @ 2025-07-21  5:02 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Ezequiel Garcia, Mauro Carvalho Chehab, linux-media, linux-kernel,
	kernel-janitors

On Tue, Jul 15, 2025 at 06:00:32PM -0500, Dan Carpenter wrote:
> This comment explains why we return success when usb_alloc_noncoherent()
> fails and I think it's helpful.  It was deleted during a recent refactor,
> but let's add it back.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Xu Yang <xu.yang_2@nxp.com>

Thanks,
Xu Yang

> ---
>  drivers/media/usb/stk1160/stk1160-video.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c
> index 416cb74377eb..3e6bffd49346 100644
> --- a/drivers/media/usb/stk1160/stk1160-video.c
> +++ b/drivers/media/usb/stk1160/stk1160-video.c
> @@ -408,8 +408,13 @@ static int stk1160_fill_urb(struct stk1160 *dev, struct stk1160_urb *stk_urb,
>  	stk_urb->transfer_buffer = usb_alloc_noncoherent(dev->udev, sb_size,
>  							 GFP_KERNEL, &stk_urb->dma,
>  							 DMA_FROM_DEVICE, &stk_urb->sgt);
> -	if (!stk_urb->transfer_buffer)
> +	if (!stk_urb->transfer_buffer) {
> +		/*
> +		 * If the buffer allocation failed, we exit but return 0 since
> +		 * we allow the driver working with less buffers.
> +		 */
>  		goto free_urb;
> +	}
>  
>  	stk_urb->dev = dev;
>  	return 0;
> -- 
> 2.47.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-21  5:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-15 23:00 [PATCH] media: stk1160: Restore deleted comment in stk1160_fill_urb() Dan Carpenter
2025-07-21  5:02 ` Xu Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).