From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, Julien Grall <julien.grall@linaro.org>,
andre.przywara@linaro.org
Subject: [PATCH] xen/arm: Surround HSR_SYSREG macro value with ()
Date: Wed, 29 Nov 2017 17:46:35 +0000 [thread overview]
Message-ID: <20171129174635.3462-1-julien.grall@linaro.org> (raw)
The value of the macro HCR_SYSREG is not surrounded by (). This means
the behavior may change depend on how it is used.
Thanksfully recent GCC will issue a warning for that.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
I am not aware of any "bad" usage today in Xen. This was found whilst
playing with sysreg emulation and GCC complaining about the missing ().
---
xen/include/asm-arm/arm64/sysregs.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/xen/include/asm-arm/arm64/sysregs.h b/xen/include/asm-arm/arm64/sysregs.h
index 084d2a1e5d..1811234249 100644
--- a/xen/include/asm-arm/arm64/sysregs.h
+++ b/xen/include/asm-arm/arm64/sysregs.h
@@ -32,11 +32,11 @@
/* These are used to decode traps with HSR.EC==HSR_EC_SYSREG */
#define HSR_SYSREG(op0,op1,crn,crm,op2) \
- ((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \
- ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \
- ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \
- ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \
- ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT)
+ (((__HSR_SYSREG_##op0) << HSR_SYSREG_OP0_SHIFT) | \
+ ((__HSR_SYSREG_##op1) << HSR_SYSREG_OP1_SHIFT) | \
+ ((__HSR_SYSREG_##crn) << HSR_SYSREG_CRN_SHIFT) | \
+ ((__HSR_SYSREG_##crm) << HSR_SYSREG_CRM_SHIFT) | \
+ ((__HSR_SYSREG_##op2) << HSR_SYSREG_OP2_SHIFT))
#define HSR_SYSREG_DCISW HSR_SYSREG(1,0,c7,c6,2)
#define HSR_SYSREG_DCCSW HSR_SYSREG(1,0,c7,c10,2)
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next reply other threads:[~2017-11-29 17:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-29 17:46 Julien Grall [this message]
2017-12-08 15:18 ` [PATCH] xen/arm: Surround HSR_SYSREG macro value with () Julien Grall
2017-12-08 21:18 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171129174635.3462-1-julien.grall@linaro.org \
--to=julien.grall@linaro.org \
--cc=andre.przywara@linaro.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.