Message ID | 20220810095356.1906405-1-burzalodowa@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | xen/arm: vgic: Fix coding style in macro REG_RANK_INDEX() | expand |
Hi Xenia, > On 10 Aug 2022, at 10:53, Xenia Ragiadakou <burzalodowa@gmail.com> wrote: > > 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 <burzalodowa@gmail.com> Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com> Cheers Bertrand > --- > xen/arch/arm/include/asm/vgic.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h > index d2a9fc7d83..3d44868039 100644 > --- a/xen/arch/arm/include/asm/vgic.h > +++ b/xen/arch/arm/include/asm/vgic.h > @@ -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); > -- > 2.34.1 >
diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h index d2a9fc7d83..3d44868039 100644 --- a/xen/arch/arm/include/asm/vgic.h +++ b/xen/arch/arm/include/asm/vgic.h @@ -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);
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 <burzalodowa@gmail.com> --- xen/arch/arm/include/asm/vgic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)