[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/arm64: address violations of MISRA C:2012 Rule 11.8
commit 5fbb3e9da95fee1a9e60452fb3ffc32a53863591 Author: Maria Celeste Cesario <maria.celeste.cesario@xxxxxxxxxxx> AuthorDate: Mon Dec 18 15:20:47 2023 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Dec 18 15:20:47 2023 +0100 xen/arm64: address violations of MISRA C:2012 Rule 11.8 The xen sources contain violations of MISRA C:2012 Rule 11.8 whose headline states: "A conversion shall not remove any const, volatile or _Atomic qualification from the type pointed to by a pointer". Add volatile qualifiers missing in casts. Arguments p and ptr are originally volatile-qualified. There's no reason to drop the qualifiers. No functional change. Signed-off-by: Maria Celeste Cesario <maria.celeste.cesario@xxxxxxxxxxx> Signed-off-by: Simone Ballarin <simone.ballarin@xxxxxxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> --- xen/arch/arm/arm64/lib/bitops.c | 6 ++++-- xen/arch/arm/include/asm/arm64/cmpxchg.h | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/arm64/lib/bitops.c b/xen/arch/arm/arm64/lib/bitops.c index 20e3f3d6ce..275a780329 100644 --- a/xen/arch/arm/arm64/lib/bitops.c +++ b/xen/arch/arm/arm64/lib/bitops.c @@ -32,7 +32,8 @@ static always_inline bool int_##name(int nr, volatile void *p, bool timeout,\ unsigned int max_try) \ { \ - volatile uint32_t *ptr = (uint32_t *)p + BITOP_WORD((unsigned int)nr); \ + volatile uint32_t *ptr = (volatile uint32_t *)p + \ + BITOP_WORD((unsigned int)nr); \ const uint32_t mask = BITOP_MASK((unsigned int)nr); \ unsigned long res, tmp; \ \ @@ -67,7 +68,8 @@ bool name##_timeout(int nr, volatile void *p, unsigned int max_try) \ static always_inline bool int_##name(int nr, volatile void *p, int *oldbit, \ bool timeout, unsigned int max_try) \ { \ - volatile uint32_t *ptr = (uint32_t *)p + BITOP_WORD((unsigned int)nr); \ + volatile uint32_t *ptr = (volatile uint32_t *)p + \ + BITOP_WORD((unsigned int)nr); \ unsigned int bit = (unsigned int)nr % BITOP_BITS_PER_WORD; \ const uint32_t mask = BITOP_MASK(bit); \ unsigned long res, tmp; \ diff --git a/xen/arch/arm/include/asm/arm64/cmpxchg.h b/xen/arch/arm/include/asm/arm64/cmpxchg.h index dbfaf91567..031fa6d92a 100644 --- a/xen/arch/arm/include/asm/arm64/cmpxchg.h +++ b/xen/arch/arm/include/asm/arm64/cmpxchg.h @@ -13,7 +13,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size "1: ldxrb %w0, %2\n" " stlxrb %w1, %w3, %2\n" " cbnz %w1, 1b\n" - : "=&r" (ret), "=&r" (tmp), "+Q" (*(u8 *)ptr) + : "=&r" (ret), "=&r" (tmp), "+Q" (*(volatile u8 *)ptr) : "r" (x) : "memory"); break; @@ -22,7 +22,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size "1: ldxrh %w0, %2\n" " stlxrh %w1, %w3, %2\n" " cbnz %w1, 1b\n" - : "=&r" (ret), "=&r" (tmp), "+Q" (*(u16 *)ptr) + : "=&r" (ret), "=&r" (tmp), "+Q" (*(volatile u16 *)ptr) : "r" (x) : "memory"); break; @@ -31,7 +31,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size "1: ldxr %w0, %2\n" " stlxr %w1, %w3, %2\n" " cbnz %w1, 1b\n" - : "=&r" (ret), "=&r" (tmp), "+Q" (*(u32 *)ptr) + : "=&r" (ret), "=&r" (tmp), "+Q" (*(volatile u32 *)ptr) : "r" (x) : "memory"); break; @@ -40,7 +40,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size "1: ldxr %0, %2\n" " stlxr %w1, %3, %2\n" " cbnz %w1, 1b\n" - : "=&r" (ret), "=&r" (tmp), "+Q" (*(u64 *)ptr) + : "=&r" (ret), "=&r" (tmp), "+Q" (*(volatile u64 *)ptr) : "r" (x) : "memory"); break; @@ -82,7 +82,7 @@ static inline bool __cmpxchg_case_##name(volatile void *ptr, \ " stxr" #sz " %w0, %" #w "4, %2\n" \ "1:\n" \ : "=&r" (res), "=&r" (oldval), \ - "+Q" (*(unsigned long *)ptr) \ + "+Q" (*(volatile unsigned long *)ptr) \ : "Ir" (*old), "r" (new) \ : "cc"); \ \ -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |