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

remoteproc: st: Fix indexing of memory-regions

The recent transition to use of_reserved_mem_region_to_resource()
changes the while loop to a for loop, but the increment of the "index"
variable was left behind at the end of the loop, as highlighted by the
following error/warning:

error: variable 'index' is incremented both in the loop header and in the loop body [-Werror,-Wfor-loop-analysis]

Drop the extra increment to avoid skipping over every other
memory-region in the loop.

Fixes: 67a7bc7f0358 ("remoteproc: Use of_reserved_mem_region_* functions for "memory-region"")
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20251126-st-remoteproc-double-index-v1-1-3b0a8b21ac18@oss.qualcomm.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>

authored by

Bjorn Andersson and committed by
Mathieu Poirier
ac82dbc5 950c74fd

-1
-1
drivers/remoteproc/st_remoteproc.c
··· 155 155 return -ENOMEM; 156 156 157 157 rproc_add_carveout(rproc, mem); 158 - index++; 159 158 } 160 159 161 160 return rproc_elf_load_rsc_table(rproc, fw);