diff options
author | Jakob Koschel <jakobkoschel@gmail.com> | 2022-03-24 10:25:03 +0300 |
---|---|---|
committer | Nishanth Menon <nm@ti.com> | 2022-04-11 16:45:56 +0300 |
commit | d281a982c2693c6a7bffaa1ae1ff3b400d6e6c74 (patch) | |
tree | b0ef579ce66063ff3eeb37eea59a3f9b4f547600 /drivers/soc/ti/knav_qmss_queue.c | |
parent | c2b0390132edffad1b52e4e84f797343b10f5ef2 (diff) | |
download | linux-d281a982c2693c6a7bffaa1ae1ff3b400d6e6c74.tar.xz |
soc: ti: replace usage of found with dedicated list iterator variable
To move the list iterator variable into the list_for_each_entry_*()
macro in the future it should be avoided to use the list iterator
variable after the loop body.
To *never* use the list iterator variable after the loop it was
concluded to use a separate iterator variable instead of a
found boolean [1].
This removes the need to use a found variable and simply checking if
the variable was set, can determine if the break/goto was hit.
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/
Link: https://lore.kernel.org/r/20220324072503.63244-1-jakobkoschel@gmail.com
Diffstat (limited to 'drivers/soc/ti/knav_qmss_queue.c')
-rw-r--r-- | drivers/soc/ti/knav_qmss_queue.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c index 2ac3856b8d42..4dbaa8c3636c 100644 --- a/drivers/soc/ti/knav_qmss_queue.c +++ b/drivers/soc/ti/knav_qmss_queue.c @@ -758,10 +758,9 @@ void *knav_pool_create(const char *name, int num_desc, int region_id) { struct knav_region *reg_itr, *region = NULL; - struct knav_pool *pool, *pi; + struct knav_pool *pool, *pi = NULL, *iter; struct list_head *node; unsigned last_offset; - bool slot_found; int ret; if (!kdev) @@ -816,18 +815,17 @@ void *knav_pool_create(const char *name, * the request */ last_offset = 0; - slot_found = false; node = ®ion->pools; - list_for_each_entry(pi, ®ion->pools, region_inst) { - if ((pi->region_offset - last_offset) >= num_desc) { - slot_found = true; + list_for_each_entry(iter, ®ion->pools, region_inst) { + if ((iter->region_offset - last_offset) >= num_desc) { + pi = iter; break; } - last_offset = pi->region_offset + pi->num_desc; + last_offset = iter->region_offset + iter->num_desc; } - node = &pi->region_inst; - if (slot_found) { + if (pi) { + node = &pi->region_inst; pool->region = region; pool->num_desc = num_desc; pool->region_offset = last_offset; |