summaryrefslogtreecommitdiffstats
path: root/drivers/bus/mhi
diff options
context:
space:
mode:
authorJeffrey Hugo <jhugo@codeaurora.org>2020-10-20 22:29:45 +0200
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2020-11-18 10:50:34 +0100
commit8ff3f7bdde45b32f9294fc87e4bd76f369178664 (patch)
treeea55b778874e492d675b0660869b297e61fede54 /drivers/bus/mhi
parentbus: mhi: core: Remove double locking from mhi_driver_remove() (diff)
downloadlinux-8ff3f7bdde45b32f9294fc87e4bd76f369178664.tar.xz
linux-8ff3f7bdde45b32f9294fc87e4bd76f369178664.zip
bus: mhi: core: fix potential operator-precedence with BHI macros
The BHI_MSMHWID and BHI_OEMPKHASH macros take a value 'n' which is a BHI register index. If 'n' is an expression rather than a simple value, there can be an operator precedence issue which can result in the incorrect calculation of the register offset. Adding parentheses around the macro parameter can prevent such issues. Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by: Hemant Kumar <hemantk@codeaurora.org> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Diffstat (limited to 'drivers/bus/mhi')
-rw-r--r--drivers/bus/mhi/core/internal.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
index 7989269ddd96..78e4e84d6743 100644
--- a/drivers/bus/mhi/core/internal.h
+++ b/drivers/bus/mhi/core/internal.h
@@ -153,8 +153,8 @@ extern struct bus_type mhi_bus_type;
#define BHI_SERIALNU (0x40)
#define BHI_SBLANTIROLLVER (0x44)
#define BHI_NUMSEG (0x48)
-#define BHI_MSMHWID(n) (0x4C + (0x4 * n))
-#define BHI_OEMPKHASH(n) (0x64 + (0x4 * n))
+#define BHI_MSMHWID(n) (0x4C + (0x4 * (n)))
+#define BHI_OEMPKHASH(n) (0x64 + (0x4 * (n)))
#define BHI_RSVD5 (0xC4)
#define BHI_STATUS_MASK (0xC0000000)
#define BHI_STATUS_SHIFT (30)