All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 01/10] media: ipu3-cio2: Simplify cleanup code
@ 2020-08-17 16:07 Andy Shevchenko
  2020-08-17 16:07 ` [PATCH v2 02/10] media: ipu3-cio2: Introduce CIO2_LOP_ENTRIES constant Andy Shevchenko
                   ` (9 more replies)
  0 siblings, 10 replies; 22+ messages in thread
From: Andy Shevchenko @ 2020-08-17 16:07 UTC (permalink / raw)
  To: linux-media
  Cc: Andy Shevchenko, Yong Zhi, Sakari Ailus, Bingbu Cao,
	Tian Shu Qiu, Mauro Carvalho Chehab

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 <andriy.shevchenko@linux.intel.com>
---
v2: converted i to unsigned (Sakari)
 drivers/media/pci/intel/ipu3/ipu3-cio2.c | 4 ++--
 1 file 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 92f5eadf2c99..cb74d49934f1 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;
-- 
2.28.0


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

end of thread, other threads:[~2020-10-09 11:41 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17 16:07 [PATCH v2 01/10] media: ipu3-cio2: Simplify cleanup code Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 02/10] media: ipu3-cio2: Introduce CIO2_LOP_ENTRIES constant Andy Shevchenko
2020-10-09  1:00   ` Laurent Pinchart
2020-10-09 10:11     ` Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 03/10] media: ipu2-cio2: Replace custom definition with PAGE_SIZE Andy Shevchenko
2020-10-09  1:04   ` Laurent Pinchart
2020-10-09 11:42     ` Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 04/10] media: ipu3-cio2: Use macros from pfn.h Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 05/10] media: ipu3-cio2: Replace infinite loop by one with clear exit condition Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 06/10] media: ipu3-cio2: Use readl_poll_timeout() helper Andy Shevchenko
2020-10-09  1:14   ` Laurent Pinchart
2020-08-17 16:07 ` [PATCH v2 07/10] media: ipu3-cio2: Get rid of pci_set_master() duplication Andy Shevchenko
2020-10-09  1:09   ` Laurent Pinchart
2020-08-17 16:07 ` [PATCH v2 08/10] media: ipu3-cio2: Drop bogus check and error message Andy Shevchenko
2020-10-09  1:18   ` Laurent Pinchart
2020-10-09 10:17     ` Andy Shevchenko
2020-08-17 16:07 ` [PATCH v2 09/10] media: ipu3-cio2: Drop useless assignments Andy Shevchenko
2020-10-09  1:19   ` Laurent Pinchart
2020-08-17 16:07 ` [PATCH v2 10/10] media: ipu3-cio2: Update Copyright year and fix indentation issues Andy Shevchenko
2020-10-09  1:15   ` Laurent Pinchart
2020-10-09  0:57 ` [PATCH v2 01/10] media: ipu3-cio2: Simplify cleanup code Laurent Pinchart
2020-10-09 10:26   ` Sakari Ailus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.