aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <[email protected]>2020-08-17 18:07:24 +0200
committerMauro Carvalho Chehab <[email protected]>2020-09-10 14:10:27 +0200
commitbbacb2740343ed6041c4e20fdc1996cc2c4917fb (patch)
tree1f0b6ec1573099b5b0fd5cb3850ea27f15c5ff98
parentd8fc21c17099635e8ebd986d042be65a6c6b5bd0 (diff)
media: ipu3-cio2: Simplify cleanup code
The code looks more nicer if we use: while (i--) instead: for (i = i - 1; i >= 0; i--) This would also allow making 'i' unsigned again. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
-rw-r--r--drivers/media/pci/intel/ipu3/ipu3-cio2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index 4e9e34857e4c..0f1bbb766509 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -847,7 +847,7 @@ static int cio2_vb2_buf_init(struct vb2_buffer *vb)
unsigned int lops = DIV_ROUND_UP(pages + 1, entries_per_page);
struct sg_table *sg;
struct sg_dma_page_iter sg_iter;
- int i, j;
+ unsigned int i, j;
if (lops <= 0 || lops > CIO2_MAX_LOPS) {
dev_err(dev, "%s: bad buffer size (%i)\n", __func__,
@@ -887,7 +887,7 @@ static int cio2_vb2_buf_init(struct vb2_buffer *vb)
b->lop[i][j] = cio2->dummy_page_bus_addr >> PAGE_SHIFT;
return 0;
fail:
- for (i--; i >= 0; i--)
+ while (i--)
dma_free_coherent(dev, CIO2_PAGE_SIZE,
b->lop[i], b->lop_bus_addr[i]);
return -ENOMEM;