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>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
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__,
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;