dmaengine: qcom: fix gpi undefined behavior
Subsystems (2)
PATCH 1/1 dmaengine: qcom: fix gpi undefined behavior
From: Arnd Bergmann <[email protected]>
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.
--- drivers/dma/qcom/gpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/qcom/gpi.c +1 -1
@@ -1948,7 +1948,7 @@ static int gpi_ch_init(struct gchan *gchan)return ret; error_start_chan: -for (i = i -1 ; i >=0 ; i++) { +for (i = i -1 ; i >=0 ; i--) {gpi_stop_chan (&gpii->gchan[i]);gpi_send_cmd (gpii, gchan,GPI_CH_CMD_RESET ); }
Signature · 1 line
2.29.2
Quoted 9 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
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
Quoted 5 lines
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.
Applied, thanks
Signature · 1 line
~Vinod
This patch was applied to qcom/linux.git (refs/heads/for-next):
Hello:
This patch was applied to qcom/linux.git (refs/heads/for-next):
Quoted 9 lines · On Sun, 3 Jan 2021 14:57:29 +0100 you wrote:
From: Arnd Bergmann <[email protected]>
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
Quoted 4 lines
1951 | for (i = i - 1; i >= 0; i++) { | ^~~[...]
Here is the summary with links:
- dmaengine: qcom: fix gpi undefined behavior
https://git.kernel.org/qcom/c/0bd1bf86ab79
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html