xen/arm: vgic: Fix coding style in macro REG_RANK_INDEX()
PATCH 1/1 xen/arm: vgic: Fix coding style in macro REG_RANK_INDEX()
Add parentheses around the macro parameter 's' to prevent against unintended expansions. This, also, resolves a MISRA C 2012 Rule 20.7 violation warning.
Add white spaces around the subtraction operator.
Signed-off-by Xenia Ragiadakou <[email protected]>
--- xen/arch/arm/include/asm/vgic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/include/asm/vgic.h +1 -1
@@ -286,7 +286,7 @@ static inline paddr_t vgic_dist_base(const struct vgic_dist *vgic)* Offset of GICD_<FOO><n> with its rank, for GICD_<FOO> size <s> with * <b>-bits-per-interrupt. */ -#define REG_RANK_INDEX (b, n, s) ((((n) >> s) & ((b)-1)) % 32) +#define REG_RANK_INDEX (b, n, s) ((((n) >> (s)) & ((b) - 1)) % 32)extern struct vcpu *vgic_get_target_vcpu (struct vcpu *v,unsigned int virq);
Signature · 1 line
2.34.1
Hi Xenia,
Quoted 8 lines · Xenia Ragiadakou
Add parentheses around the macro parameter 's' to prevent against unintended expansions. This, also, resolves a MISRA C 2012 Rule 20.7 violation warning.
Add white spaces around the subtraction operator.
Signed-off-by Xenia Ragiadakou <[email protected]>
Reviewed-by Bertrand Marquis <[email protected]>
Cheers
Bertrand
Quoted 20 lines
---
xen/arch/arm/include/asm/vgic.h| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/arm/include/asm/vgic.h +1
-1@@ -286,7 +286,7 @@ static inline paddr_t vgic_dist_base(const struct vgic_dist *vgic)* Offset of GICD_<FOO><n> with its rank, for GICD_<FOO> size <s> with * <b>-bits-per-interrupt. */ -#define REG_RANK_INDEX (b, n, s) ((((n) >> s) & ((b)-1)) % 32) +#define REG_RANK_INDEX (b, n, s) ((((n) >> (s)) & ((b) - 1)) % 32)extern struct vcpu *vgic_get_target_vcpu (struct vcpu *v,unsigned int virq);Signature · 1 line
2.34.1