* [PATCH] bus: mhi: core: fix potential operator-precedence with BHI macros
@ 2020-10-20 20:29 Jeffrey Hugo
2020-10-21 16:33 ` Hemant Kumar
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jeffrey Hugo @ 2020-10-20 20:29 UTC (permalink / raw)
To: manivannan.sadhasivam, hemantk, bbhatt
Cc: linux-arm-msm, linux-kernel, Jeffrey Hugo
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>
---
drivers/bus/mhi/core/internal.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
index 7989269..78e4e84 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)
--
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] bus: mhi: core: fix potential operator-precedence with BHI macros
2020-10-20 20:29 [PATCH] bus: mhi: core: fix potential operator-precedence with BHI macros Jeffrey Hugo
@ 2020-10-21 16:33 ` Hemant Kumar
2020-11-05 14:13 ` Manivannan Sadhasivam
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Hemant Kumar @ 2020-10-21 16:33 UTC (permalink / raw)
To: Jeffrey Hugo, manivannan.sadhasivam, bbhatt; +Cc: linux-arm-msm, linux-kernel
On 10/20/20 1:29 PM, Jeffrey Hugo wrote:
> 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: Hemant Kumar <hemantk@codeaurora.org>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bus: mhi: core: fix potential operator-precedence with BHI macros
2020-10-20 20:29 [PATCH] bus: mhi: core: fix potential operator-precedence with BHI macros Jeffrey Hugo
2020-10-21 16:33 ` Hemant Kumar
@ 2020-11-05 14:13 ` Manivannan Sadhasivam
2020-11-09 12:00 ` Manivannan Sadhasivam
2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
3 siblings, 0 replies; 5+ messages in thread
From: Manivannan Sadhasivam @ 2020-11-05 14:13 UTC (permalink / raw)
To: Jeffrey Hugo; +Cc: hemantk, bbhatt, linux-arm-msm, linux-kernel
On Tue, Oct 20, 2020 at 02:29:45PM -0600, Jeffrey Hugo wrote:
> 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>
Thanks,
Mani
> ---
> drivers/bus/mhi/core/internal.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
> index 7989269..78e4e84 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)
> --
> Qualcomm Technologies, Inc. is a member of the
> Code Aurora Forum, a Linux Foundation Collaborative Project.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bus: mhi: core: fix potential operator-precedence with BHI macros
2020-10-20 20:29 [PATCH] bus: mhi: core: fix potential operator-precedence with BHI macros Jeffrey Hugo
2020-10-21 16:33 ` Hemant Kumar
2020-11-05 14:13 ` Manivannan Sadhasivam
@ 2020-11-09 12:00 ` Manivannan Sadhasivam
2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
3 siblings, 0 replies; 5+ messages in thread
From: Manivannan Sadhasivam @ 2020-11-09 12:00 UTC (permalink / raw)
To: Jeffrey Hugo; +Cc: hemantk, bbhatt, linux-arm-msm, linux-kernel
On Tue, Oct 20, 2020 at 02:29:45PM -0600, Jeffrey Hugo wrote:
> 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>
Applied to mhi-next!
Thanks,
Mani
> ---
> drivers/bus/mhi/core/internal.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
> index 7989269..78e4e84 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)
> --
> Qualcomm Technologies, Inc. is a member of the
> Code Aurora Forum, a Linux Foundation Collaborative Project.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] bus: mhi: core: fix potential operator-precedence with BHI macros
2020-10-20 20:29 [PATCH] bus: mhi: core: fix potential operator-precedence with BHI macros Jeffrey Hugo
` (2 preceding siblings ...)
2020-11-09 12:00 ` Manivannan Sadhasivam
@ 2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2020-12-29 20:15 UTC (permalink / raw)
To: Jeffrey Hugo; +Cc: linux-arm-msm
Hello:
This patch was applied to qcom/linux.git (refs/heads/for-next):
On Tue, 20 Oct 2020 14:29:45 -0600 you wrote:
> 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>
>
> [...]
Here is the summary with links:
- bus: mhi: core: fix potential operator-precedence with BHI macros
https://git.kernel.org/qcom/c/8ff3f7bdde45
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-29 20:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20 20:29 [PATCH] bus: mhi: core: fix potential operator-precedence with BHI macros Jeffrey Hugo
2020-10-21 16:33 ` Hemant Kumar
2020-11-05 14:13 ` Manivannan Sadhasivam
2020-11-09 12:00 ` Manivannan Sadhasivam
2020-12-29 20:15 ` patchwork-bot+linux-arm-msm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).