Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iop-adma: redundant/wrong tests in iop_*_count()?

When we reach the loop, len is at least 1, we only stay in the loop when
len is at least MAX_BYTE_COUNT + 1, MAX_BYTE_COUNT is subtracted in each
iteration. So when we leave the loop, or didn't take it, len is at least 1.
Testing whether len is non-zero appears redundant.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>

authored by

Roel Kluin and committed by
Dan Williams
f1acb878 67b9124f

+4 -8
+4 -8
arch/arm/include/asm/hardware/iop3xx-adma.h
··· 366 366 slot_cnt += *slots_per_op; 367 367 } 368 368 369 - if (len) 370 - slot_cnt += *slots_per_op; 369 + slot_cnt += *slots_per_op; 371 370 372 371 return slot_cnt; 373 372 } ··· 388 389 slot_cnt += *slots_per_op; 389 390 } 390 391 391 - if (len) 392 - slot_cnt += *slots_per_op; 392 + slot_cnt += *slots_per_op; 393 393 394 394 return slot_cnt; 395 395 } ··· 735 737 i += slots_per_op; 736 738 } while (len > IOP_ADMA_ZERO_SUM_MAX_BYTE_COUNT); 737 739 738 - if (len) { 739 - iter = iop_hw_desc_slot_idx(hw_desc, i); 740 - iter->byte_count = len; 741 - } 740 + iter = iop_hw_desc_slot_idx(hw_desc, i); 741 + iter->byte_count = len; 742 742 } 743 743 } 744 744