Skip to content
  1. Oct 30, 2021
  2. Oct 29, 2021
  3. Oct 28, 2021
  4. Oct 27, 2021
  5. Oct 26, 2021
    • Arnd Bergmann's avatar
      dma-buf: st: fix error handling in test_get_fences() · 55d5e4f9
      Arnd Bergmann authored
      The new driver incorrectly unwinds after errors, as clang points out:
      
      drivers/dma-buf/st-dma-resv.c:295:7: error: variable 'i' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                      if (r) {
                          ^
      drivers/dma-buf/st-dma-resv.c:336:9: note: uninitialized use occurs here
              while (i--)
                     ^
      drivers/dma-buf/st-dma-resv.c:295:3: note: remove the 'if' if its condition is always false
                      if (r) {
                      ^~~~~~~~
      drivers/dma-buf/st-dma-resv.c:288:6: error: variable 'i' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
              if (r) {
                  ^
      drivers/dma-buf/st-dma-resv.c:336:9: note: uninitialized use occurs here
              while (i--)
                     ^
      drivers/dma-buf/st-dma-resv.c:288:2: note: remove the 'if' if its condition is always false
              if (r) {
              ^~~~~~~~
      drivers/dma-buf/st-dma-resv.c:280:10: note: initialize the variable 'i' to silence this warning
              int r, i;
                      ^
                       = 0
      
      Skip cleaning up the bits that have not been allocated at this point.
      
      Fixes: 1d51775c
      
       ("dma-buf: add dma_resv selftest v4")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20211026083448.3471055-1-arnd@kernel.org
      
      
      Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
      55d5e4f9