diff options
| author | Taticharla Venkata Sai <venkatasai.taticharla@amd.com> | 2025-07-23 10:10:41 +0000 |
|---|---|---|
| committer | Venkata Sai Taticharla <venkatasai.taticharla@amd.com> | 2026-01-08 16:31:27 +0000 |
| commit | c9535e669ef4e494b7afc612c8a32706ab3ebd0f (patch) | |
| tree | 833cdc201ebbc4092b27f7ef6061d63db43c6427 | |
| parent | 18f8d11e5489ed140917007294ae681265150c7d (diff) | |
| download | arm-trusted-firmware-c9535e669ef4e494b7afc612c8a32706ab3ebd0f.tar.gz arm-trusted-firmware-c9535e669ef4e494b7afc612c8a32706ab3ebd0f.zip | |
fix(optee): add parenthesis for macro expressions
This corrects MISRA violation C2012‑20.7:
macro parameters used within expressions
were not enclosed in parentheses, risking
incorrect operator precedence after expansion.
The fix wraps all macro parameters in expressions
with parentheses to ensure intended evaluation
order and compliance with the rule.
Change-Id: Iaf5626afab2d8d8d945caf96798e0a8b33b32e53
Signed-off-by: Taticharla Venkata Sai <venkatasai.taticharla@amd.com>
| -rw-r--r-- | services/spd/opteed/opteed_private.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/services/spd/opteed/opteed_private.h b/services/spd/opteed/opteed_private.h index 076991f7a..312f2bf13 100644 --- a/services/spd/opteed/opteed_private.h +++ b/services/spd/opteed/opteed_private.h @@ -24,14 +24,14 @@ #define OPTEE_PSTATE_UNKNOWN 0U #define OPTEE_PSTATE_SHIFT 0U #define OPTEE_PSTATE_MASK 0x3U -#define get_optee_pstate(state) ((state >> OPTEE_PSTATE_SHIFT) & \ +#define get_optee_pstate(state) (((state) >> OPTEE_PSTATE_SHIFT) & \ OPTEE_PSTATE_MASK) #define clr_optee_pstate(state) (state &= ~(OPTEE_PSTATE_MASK \ << OPTEE_PSTATE_SHIFT)) #define set_optee_pstate(st, pst) do { \ - clr_optee_pstate(st); \ - st |= (pst & OPTEE_PSTATE_MASK) << \ - OPTEE_PSTATE_SHIFT; \ + clr_optee_pstate((st)); \ + (st) |= (((pst) & OPTEE_PSTATE_MASK) << \ + OPTEE_PSTATE_SHIFT); \ } while (false) |
