Skip to content

Commit 29e3e06

Browse files
reid-pjic23
authored andcommitted
iio: buffer-dma: Use ARRAY_SIZE in for loop range
Use the ARRAY_SIZE macro in the for loops that access queue->fileio.blocks. Macro is already used in a couple of places where this access occurs, but range was hardcoded in these locations. Signed-off-by: Phil Reid <preid@electromag.com.au> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent c48c7b2 commit 29e3e06

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/iio/buffer/industrialio-buffer-dma.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ int iio_dma_buffer_request_update(struct iio_buffer *buffer)
305305
queue->fileio.active_block = NULL;
306306

307307
spin_lock_irq(&queue->list_lock);
308-
for (i = 0; i < 2; i++) {
308+
for (i = 0; i < ARRAY_SIZE(queue->fileio.blocks); i++) {
309309
block = queue->fileio.blocks[i];
310310

311311
/* If we can't re-use it free it */
@@ -323,7 +323,7 @@ int iio_dma_buffer_request_update(struct iio_buffer *buffer)
323323

324324
INIT_LIST_HEAD(&queue->incoming);
325325

326-
for (i = 0; i < 2; i++) {
326+
for (i = 0; i < ARRAY_SIZE(queue->fileio.blocks); i++) {
327327
if (queue->fileio.blocks[i]) {
328328
block = queue->fileio.blocks[i];
329329
if (block->state == IIO_BLOCK_STATE_DEAD) {

0 commit comments

Comments
 (0)