diff mbox series

[1/3] media: stk1160: fix number of buffers in case not all buffers are created

Message ID 20220111065505.6323-2-dafna.hirschfeld@collabora.com
State New
Headers show
Series [1/3] media: stk1160: fix number of buffers in case not all buffers are created | expand

Commit Message

Dafna Hirschfeld Jan. 11, 2022, 6:55 a.m. UTC
In case we fail to allocate a transfer_buffer then we
break the buffers creation loop and update the number of
buffers to the number of successfully allocated which should
be 'i' and not 'i - 1'

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 drivers/media/usb/stk1160/stk1160-video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ezequiel Garcia Jan. 11, 2022, 12:21 p.m. UTC | #1
On Tue, Jan 11, 2022 at 08:55:03AM +0200, Dafna Hirschfeld wrote:
> In case we fail to allocate a transfer_buffer then we
> break the buffers creation loop and update the number of
> buffers to the number of successfully allocated which should
> be 'i' and not 'i - 1'
> 
> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>

Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>

> ---
>  drivers/media/usb/stk1160/stk1160-video.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c
> index 202b084f65a2..91bd6adccdd1 100644
> --- a/drivers/media/usb/stk1160/stk1160-video.c
> +++ b/drivers/media/usb/stk1160/stk1160-video.c
> @@ -511,9 +511,9 @@ int stk1160_alloc_isoc(struct stk1160 *dev)
>  	usb_free_urb(dev->isoc_ctl.urb[i]);
>  	dev->isoc_ctl.urb[i] = NULL;
>  
> -	stk1160_warn("%d urbs allocated. Trying to continue...\n", i - 1);
> +	stk1160_warn("%d urbs allocated. Trying to continue...\n", i);
>  
> -	dev->isoc_ctl.num_bufs = i - 1;
> +	dev->isoc_ctl.num_bufs = i;
>  
>  	return 0;
>  
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c
index 202b084f65a2..91bd6adccdd1 100644
--- a/drivers/media/usb/stk1160/stk1160-video.c
+++ b/drivers/media/usb/stk1160/stk1160-video.c
@@ -511,9 +511,9 @@  int stk1160_alloc_isoc(struct stk1160 *dev)
 	usb_free_urb(dev->isoc_ctl.urb[i]);
 	dev->isoc_ctl.urb[i] = NULL;
 
-	stk1160_warn("%d urbs allocated. Trying to continue...\n", i - 1);
+	stk1160_warn("%d urbs allocated. Trying to continue...\n", i);
 
-	dev->isoc_ctl.num_bufs = i - 1;
+	dev->isoc_ctl.num_bufs = i;
 
 	return 0;