All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries
@ 2021-03-09 18:44 Bhaumik Bhatt
  2021-03-09 18:56 ` Jeffrey Hugo
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Bhaumik Bhatt @ 2021-03-09 18:44 UTC (permalink / raw)
  To: manivannan.sadhasivam
  Cc: linux-arm-msm, hemantk, jhugo, linux-kernel, carl.yin,
	naveen.kumar, loic.poulain, Bhaumik Bhatt

As per documentation, fields marked as (required) in an MHI
controller structure need to be populated by the controller driver
before calling mhi_register_controller(). Ensure all required
pointers and non-zero fields are present in the controller before
proceeding with the registration.

Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
---
 v3: removed fw_image as not all controllers require it
 v2: removed iova_start and iova_stop as they can be zero

 drivers/bus/mhi/core/init.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
index 272f350..d8882b3 100644
--- a/drivers/bus/mhi/core/init.c
+++ b/drivers/bus/mhi/core/init.c
@@ -879,12 +879,10 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl,
 	u32 soc_info;
 	int ret, i;
 
-	if (!mhi_cntrl)
-		return -EINVAL;
-
-	if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||
+	if (!mhi_cntrl || !mhi_cntrl->cntrl_dev || !mhi_cntrl->regs ||
+	    !mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||
 	    !mhi_cntrl->status_cb || !mhi_cntrl->read_reg ||
-	    !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs)
+	    !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs || !mhi_cntrl->irq)
 		return -EINVAL;
 
 	ret = parse_config(mhi_cntrl, config);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries
  2021-03-09 18:44 [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries Bhaumik Bhatt
@ 2021-03-09 18:56 ` Jeffrey Hugo
  2021-03-09 18:56 ` Jeffrey Hugo
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jeffrey Hugo @ 2021-03-09 18:56 UTC (permalink / raw)
  To: Bhaumik Bhatt, manivannan.sadhasivam
  Cc: linux-arm-msm, hemantk, linux-kernel, carl.yin, naveen.kumar,
	loic.poulain

On 3/9/2021 11:44 AM, Bhaumik Bhatt wrote:
> As per documentation, fields marked as (required) in an MHI
> controller structure need to be populated by the controller driver
> before calling mhi_register_controller(). Ensure all required
> pointers and non-zero fields are present in the controller before
> proceeding with the registration.
> 
> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>

Reviewed-by: Jeffrey Hugo <jhugo@codeaurora.org>

-- 
Jeffrey Hugo
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries
  2021-03-09 18:44 [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries Bhaumik Bhatt
  2021-03-09 18:56 ` Jeffrey Hugo
@ 2021-03-09 18:56 ` Jeffrey Hugo
  2021-03-10 13:51 ` Manivannan Sadhasivam
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jeffrey Hugo @ 2021-03-09 18:56 UTC (permalink / raw)
  To: Bhaumik Bhatt, manivannan.sadhasivam
  Cc: linux-arm-msm, hemantk, linux-kernel, carl.yin, naveen.kumar,
	loic.poulain

On 3/9/2021 11:44 AM, Bhaumik Bhatt wrote:
> As per documentation, fields marked as (required) in an MHI
> controller structure need to be populated by the controller driver
> before calling mhi_register_controller(). Ensure all required
> pointers and non-zero fields are present in the controller before
> proceeding with the registration.
> 
> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
> ---

Reviewed-by: Jeffrey Hugo <jhugo@codeaurora.org>

-- 
Jeffrey Hugo
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries
  2021-03-09 18:44 [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries Bhaumik Bhatt
  2021-03-09 18:56 ` Jeffrey Hugo
  2021-03-09 18:56 ` Jeffrey Hugo
@ 2021-03-10 13:51 ` Manivannan Sadhasivam
  2021-03-10 13:53 ` Manivannan Sadhasivam
  2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  4 siblings, 0 replies; 6+ messages in thread
From: Manivannan Sadhasivam @ 2021-03-10 13:51 UTC (permalink / raw)
  To: Bhaumik Bhatt
  Cc: linux-arm-msm, hemantk, jhugo, linux-kernel, carl.yin,
	naveen.kumar, loic.poulain

On Tue, Mar 09, 2021 at 10:44:50AM -0800, Bhaumik Bhatt wrote:
> As per documentation, fields marked as (required) in an MHI
> controller structure need to be populated by the controller driver
> before calling mhi_register_controller(). Ensure all required
> pointers and non-zero fields are present in the controller before
> proceeding with the registration.
> 
> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> ---
>  v3: removed fw_image as not all controllers require it
>  v2: removed iova_start and iova_stop as they can be zero
> 
>  drivers/bus/mhi/core/init.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index 272f350..d8882b3 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -879,12 +879,10 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl,
>  	u32 soc_info;
>  	int ret, i;
>  
> -	if (!mhi_cntrl)
> -		return -EINVAL;
> -
> -	if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||
> +	if (!mhi_cntrl || !mhi_cntrl->cntrl_dev || !mhi_cntrl->regs ||
> +	    !mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||
>  	    !mhi_cntrl->status_cb || !mhi_cntrl->read_reg ||
> -	    !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs)
> +	    !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs || !mhi_cntrl->irq)
>  		return -EINVAL;
>  
>  	ret = parse_config(mhi_cntrl, config);
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries
  2021-03-09 18:44 [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries Bhaumik Bhatt
                   ` (2 preceding siblings ...)
  2021-03-10 13:51 ` Manivannan Sadhasivam
@ 2021-03-10 13:53 ` Manivannan Sadhasivam
  2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  4 siblings, 0 replies; 6+ messages in thread
From: Manivannan Sadhasivam @ 2021-03-10 13:53 UTC (permalink / raw)
  To: Bhaumik Bhatt
  Cc: linux-arm-msm, hemantk, jhugo, linux-kernel, carl.yin,
	naveen.kumar, loic.poulain

On Tue, Mar 09, 2021 at 10:44:50AM -0800, Bhaumik Bhatt wrote:
> As per documentation, fields marked as (required) in an MHI
> controller structure need to be populated by the controller driver
> before calling mhi_register_controller(). Ensure all required
> pointers and non-zero fields are present in the controller before
> proceeding with the registration.
> 
> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>

Applied to mhi-next!

Thanks,
Mani

> ---
>  v3: removed fw_image as not all controllers require it
>  v2: removed iova_start and iova_stop as they can be zero
> 
>  drivers/bus/mhi/core/init.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index 272f350..d8882b3 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -879,12 +879,10 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl,
>  	u32 soc_info;
>  	int ret, i;
>  
> -	if (!mhi_cntrl)
> -		return -EINVAL;
> -
> -	if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||
> +	if (!mhi_cntrl || !mhi_cntrl->cntrl_dev || !mhi_cntrl->regs ||
> +	    !mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put ||
>  	    !mhi_cntrl->status_cb || !mhi_cntrl->read_reg ||
> -	    !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs)
> +	    !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs || !mhi_cntrl->irq)
>  		return -EINVAL;
>  
>  	ret = parse_config(mhi_cntrl, config);
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries
  2021-03-09 18:44 [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries Bhaumik Bhatt
                   ` (3 preceding siblings ...)
  2021-03-10 13:53 ` Manivannan Sadhasivam
@ 2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2021-05-26 19:03 UTC (permalink / raw)
  To: Bhaumik Bhatt; +Cc: linux-arm-msm

Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Tue,  9 Mar 2021 10:44:50 -0800 you wrote:
> As per documentation, fields marked as (required) in an MHI
> controller structure need to be populated by the controller driver
> before calling mhi_register_controller(). Ensure all required
> pointers and non-zero fields are present in the controller before
> proceeding with the registration.
> 
> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
> 
> [...]

Here is the summary with links:
  - [v3] bus: mhi: core: Add missing checks for MMIO register entries
    https://git.kernel.org/qcom/c/8de5ad994143

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] 6+ messages in thread

end of thread, other threads:[~2021-05-26 19:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 18:44 [PATCH v3] bus: mhi: core: Add missing checks for MMIO register entries Bhaumik Bhatt
2021-03-09 18:56 ` Jeffrey Hugo
2021-03-09 18:56 ` Jeffrey Hugo
2021-03-10 13:51 ` Manivannan Sadhasivam
2021-03-10 13:53 ` Manivannan Sadhasivam
2021-05-26 19:03 ` patchwork-bot+linux-arm-msm

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.