aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-06-21 21:03:16 +0200
committerAnup Patel <anup@brainfault.org>2021-06-22 19:16:52 +0530
commit11c345f14a3e3c67e688024094f72de4f92c87a4 (patch)
tree1f0fb26b70a281e178f84a5e6caf030648b6decd
parent99017946f36525c0689d287fbad21426575944c4 (diff)
lib: simplify sbi_fifo_inplace_update()
Don't assign an unused value to variable index. Use operator '-=' where applicable. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Xiang W <wxjstz@126.com>
-rw-r--r--lib/sbi/sbi_fifo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sbi/sbi_fifo.c b/lib/sbi/sbi_fifo.c
index 2a5c012..b2395f3 100644
--- a/lib/sbi/sbi_fifo.c
+++ b/lib/sbi/sbi_fifo.c
@@ -118,7 +118,7 @@ bool sbi_fifo_reset(struct sbi_fifo *fifo)
int sbi_fifo_inplace_update(struct sbi_fifo *fifo, void *in,
int (*fptr)(void *in, void *data))
{
- int i, index = 0;
+ int i, index;
int ret = SBI_FIFO_UNCHANGED;
void *entry;
@@ -135,7 +135,7 @@ int sbi_fifo_inplace_update(struct sbi_fifo *fifo, void *in,
for (i = 0; i < fifo->avail; i++) {
index = fifo->tail + i;
if (index >= fifo->num_entries)
- index = index - fifo->num_entries;
+ index -= fifo->num_entries;
entry = (void *)fifo->queue + (u32)index * fifo->entry_size;
ret = fptr(in, entry);