Loop invariant is inside the loop so code checks invariant on each iteration of the loop. Invariant can be moved outside of the loop so it is only checked once. Move loop invariant outside of for loop. Signed-off-by: Tobin C. Harding <me@xxxxxxxx> --- drivers/staging/comedi/drivers/cb_pcidas64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 3b98193..dff0648 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1496,8 +1496,8 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) if (!devpriv->ai_buffer[i]) return -ENOMEM; } - for (i = 0; i < AO_DMA_RING_COUNT; i++) { - if (ao_cmd_is_supported(board)) { + if (ao_cmd_is_supported(board)) { + for (i = 0; i < AO_DMA_RING_COUNT; i++) { devpriv->ao_buffer[i] = dma_alloc_coherent(&pcidev->dev, DMA_BUFFER_SIZE, -- 2.7.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel