Message ID | 20220125080213.30090-2-dafna.hirschfeld@collabora.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | stk1160: allocate urb buffs with the DMA noncontiguous API | expand |
Hi Dafna, On Tue, 25 Jan 2022 at 05:02, Dafna Hirschfeld <dafna.hirschfeld@collabora.com> 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' nor 'i + 1' > > Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Thanks! > --- > 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 >
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; }
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(-)