Linux Media Controller development
 help / color / mirror / Atom feed
From: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
To: ezequiel@vanguardiasur.com.ar
Cc: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	kernel@collabora.com, linux-media@vger.kernel.org,
	laurent.pinchart@ideasonboard.com, hverkuil@xs4all.nl,
	ribalda@chromium.org, tfiga@chromium.org, senozhatsky@google.com,
	hch@lst.de, dafna3@gmail.com
Subject: [PATCH v2 1/4] media: stk1160: fix number of buffers in case not all buffers are created
Date: Tue, 25 Jan 2022 10:02:10 +0200	[thread overview]
Message-ID: <20220125080213.30090-2-dafna.hirschfeld@collabora.com> (raw)
In-Reply-To: <20220125080213.30090-1-dafna.hirschfeld@collabora.com>

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' nor 'i + 1'

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

diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c
index 202b084f65a2..92c8b1fba2b0 100644
--- a/drivers/media/usb/stk1160/stk1160-video.c
+++ b/drivers/media/usb/stk1160/stk1160-video.c
@@ -511,15 +511,15 @@ 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;
 
 free_i_bufs:
 	/* Save the allocated buffers so far, so we can properly free them */
-	dev->isoc_ctl.num_bufs = i+1;
+	dev->isoc_ctl.num_bufs = i;
 	stk1160_free_isoc(dev);
 	return -ENOMEM;
 }
-- 
2.17.1


  reply	other threads:[~2022-01-25  8:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25  8:02 [PATCH v2 0/4] stk1160: allocate urb buffs with the DMA noncontiguous API Dafna Hirschfeld
2022-01-25  8:02 ` Dafna Hirschfeld [this message]
2022-02-06 11:39   ` [PATCH v2 1/4] media: stk1160: fix number of buffers in case not all buffers are created Ezequiel Garcia
2022-01-25  8:02 ` [PATCH v2 2/4] media: stk1160: If start stream fails, return buffers with VB2_BUF_STATE_QUEUED Dafna Hirschfeld
2022-02-06 11:40   ` Ezequiel Garcia
2022-01-25  8:02 ` [PATCH v2 3/4] media: stk1160: move transfer_buffer and urb to same struct 'stk1160_urb' Dafna Hirschfeld
2022-02-07 15:08   ` Ezequiel Garcia
2022-01-25  8:02 ` [PATCH v2 4/4] media: stk1160: use dma_alloc_noncontiguous API Dafna Hirschfeld
2022-02-07 15:13   ` Ezequiel Garcia

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=20220125080213.30090-2-dafna.hirschfeld@collabora.com \
    --to=dafna.hirschfeld@collabora.com \
    --cc=dafna3@gmail.com \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=hch@lst.de \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=ribalda@chromium.org \
    --cc=senozhatsky@google.com \
    --cc=tfiga@chromium.org \
    /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