Skip to content

Commit

Permalink
drm/exec: use unique instead of local label
Browse files Browse the repository at this point in the history
GCC forbids to jump to labels in loop conditions and a new clang
check stumbled over this.

So instead using a local label inside the loop condition use an
unique label outside of it.

Fixes: 09593216bff1 ("drm: execution context for GEM buffers v7")
Link: https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
Link: ClangBuiltLinux/linux#1890
Link: llvm/llvm-project@2021910
Reported-by: Nathan Chancellor <nathan@kernel.org>
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
CC: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230731123625.3766-1-christian.koenig@amd.com
  • Loading branch information
ChristianKoenigAMD authored and lutzbichler committed Feb 4, 2024
1 parent 9e7214a commit 432204d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions include/drm/drm_exec.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#ifndef __DRM_EXEC_H__
#define __DRM_EXEC_H__

#include <linux/compiler.h>
#include <linux/ww_mutex.h>

#define DRM_EXEC_INTERRUPTIBLE_WAIT BIT(0)
Expand Down Expand Up @@ -74,13 +75,12 @@ struct drm_exec {
* Since labels can't be defined local to the loops body we use a jump pointer
* to make sure that the retry is only used from within the loops body.
*/
#define drm_exec_until_all_locked(exec) \
for (void *__drm_exec_retry_ptr; ({ \
__label__ __drm_exec_retry; \
__drm_exec_retry: \
__drm_exec_retry_ptr = &&__drm_exec_retry; \
(void)__drm_exec_retry_ptr; \
drm_exec_cleanup(exec); \
#define drm_exec_until_all_locked(exec) \
__PASTE(__drm_exec_, __LINE__): \
for (void *__drm_exec_retry_ptr; ({ \
__drm_exec_retry_ptr = &&__PASTE(__drm_exec_, __LINE__);\
(void)__drm_exec_retry_ptr; \
drm_exec_cleanup(exec); \
});)

/**
Expand Down

0 comments on commit 432204d

Please sign in to comment.