Skip to content

Instantly share code, notes, and snippets.

@conor-pwbot
Created May 21, 2023 13:57
Show Gist options
  • Save conor-pwbot/5e804a2524f14ea86844faf67cb40f15 to your computer and use it in GitHub Desktop.
Save conor-pwbot/5e804a2524f14ea86844faf67cb40f15 to your computer and use it in GitHub Desktop.
CHECK: Macro argument 'cond_expr' may be better as '(cond_expr)' to avoid precedence issues
CHECK: Macro argument 'ptr' may be better as '(ptr)' to avoid precedence issues
ERROR: Macros with complex values should be enclosed in parentheses
WARNING: memory barrier without comment
==========
checkpatch - FAILED
CHECK: Macro argument 'ptr' may be better as '(ptr)' to avoid precedence issues
#82: FILE: arch/riscv/include/asm/barrier.h:49:
+#define ___smp_load_reservedN(pfx, ptr) \
+({ \
+ typeof(*ptr) ___p1; \
+ __asm__ __volatile__ ("lr." pfx " %[p], %[c]\n" \
+ : [p]"=&r" (___p1), [c]"+A"(*ptr)); \
+ ___p1; \
+})
CHECK: Macro argument 'ptr' may be better as '(ptr)' to avoid precedence issues
#90: FILE: arch/riscv/include/asm/barrier.h:57:
+#define __smp_load_reserved_relaxed(ptr) \
+({ \
+ typeof(*ptr) ___p1; \
+ if (sizeof(*ptr) == sizeof(int)) \
+ ___p1 = ___smp_load_reservedN("w", ptr); \
+ else if (sizeof(*ptr) == sizeof(long)) \
+ ___p1 = ___smp_load_reservedN("d", ptr); \
+ else \
+ compiletime_assert(0, \
+ "Need type compatible with LR/SC instructions " \
+ "for " __stringify(ptr)); \
+ ___p1; \
+})
CHECK: Macro argument 'ptr' may be better as '(ptr)' to avoid precedence issues
#104: FILE: arch/riscv/include/asm/barrier.h:71:
+#define __smp_load_reserved_acquire(ptr) \
+({ \
+ typeof(*ptr) ___p1; \
+ ___p1 = __smp_load_reserved_relaxed(ptr); \
+ RISCV_FENCE(r, rw); \
+ ___p1; \
+})
CHECK: Macro argument 'cond_expr' may be better as '(cond_expr)' to avoid precedence issues
#119: FILE: arch/riscv/include/asm/barrier.h:106:
+#define smp_cond_load_relaxed(ptr, cond_expr) \
+({ \
+ typeof(ptr) __PTR = (ptr); \
+ __unqual_scalar_typeof(*ptr) VAL; \
+ VAL = READ_ONCE(*__PTR); \
+ if (!cond_expr) { \
+ for (;;) { \
+ VAL = __smp_load_reserved_relaxed(__PTR); \
+ if (cond_expr) \
+ break; \
+ ALT_WRS_STO(); \
+ } \
+ } \
+ (typeof(*ptr))VAL; \
+})
CHECK: Macro argument 'cond_expr' may be better as '(cond_expr)' to avoid precedence issues
#135: FILE: arch/riscv/include/asm/barrier.h:122:
+#define smp_cond_load_acquire(ptr, cond_expr) \
+({ \
+ typeof(ptr) __PTR = (ptr); \
+ __unqual_scalar_typeof(*ptr) VAL; \
+ VAL = smp_load_acquire(__PTR); \
+ if (!cond_expr) { \
+ for (;;) { \
+ VAL = __smp_load_reserved_acquire(__PTR); \
+ if (cond_expr) \
+ break; \
+ ALT_WRS_STO(); \
+ } \
+ } \
+ (typeof(*ptr))VAL; \
+})
WARNING: memory barrier without comment
#139: FILE: arch/riscv/include/asm/barrier.h:126:
+ VAL = smp_load_acquire(__PTR); \
ERROR: Macros with complex values should be enclosed in parentheses
#163: FILE: arch/riscv/include/asm/errata_list.h:48:
+#define ALT_WRS_NTO() \
+asm volatile(ALTERNATIVE( \
+ "nop\n\t", \
+ ZAWRS_WRS_NTO "\n\t", \
+ 0, RISCV_ISA_EXT_ZAWRS, CONFIG_RISCV_ISA_ZAWRS))
ERROR: Macros with complex values should be enclosed in parentheses
#170: FILE: arch/riscv/include/asm/errata_list.h:55:
+#define ALT_WRS_STO() \
+asm volatile(ALTERNATIVE( \
+ "nop\n\t", \
+ ZAWRS_WRS_STO "\n\t", \
+ 0, RISCV_ISA_EXT_ZAWRS, CONFIG_RISCV_ISA_ZAWRS))
total: 2 errors, 1 warnings, 5 checks, 139 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
Commit 0efd7bf97578 ("riscv: Add Zawrs support for spinlocks") has style problems, please review.
NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment