Skip to content

Commit 0bd1bf8

Browse files
arndbvinodkoul
authored andcommitted
dmaengine: qcom: fix gpi undefined behavior
gcc points out an incorrect error handling loop: drivers/dma/qcom/gpi.c: In function 'gpi_ch_init': drivers/dma/qcom/gpi.c:1254:15: error: iteration 2 invokes undefined behavior [-Werror=aggressive-loop-optimizations] 1254 | struct gpii *gpii = gchan->gpii; | ^~~~ drivers/dma/qcom/gpi.c:1951:2: note: within this loop 1951 | for (i = i - 1; i >= 0; i++) { | ^~~ Change the loop to correctly walk backwards through the initialized fields rather than off into the woods. Fixes: 5d0c353 ("dmaengine: qcom: Add GPI dma driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20210103135738.3741123-1-arnd@kernel.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent cc465fa commit 0bd1bf8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/dma/qcom/gpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ static int gpi_ch_init(struct gchan *gchan)
19481948
return ret;
19491949

19501950
error_start_chan:
1951-
for (i = i - 1; i >= 0; i++) {
1951+
for (i = i - 1; i >= 0; i--) {
19521952
gpi_stop_chan(&gpii->gchan[i]);
19531953
gpi_send_cmd(gpii, gchan, GPI_CH_CMD_RESET);
19541954
}

0 commit comments

Comments
 (0)