diff mbox series

pinctrl: qcom: lpass lpi: use default pullup/strength values

Message ID 20210304194816.3843-1-jonathan@marek.ca
State Accepted
Commit 2a9be38099e338f597c14d3cb851849b01db05f6
Headers show
Series pinctrl: qcom: lpass lpi: use default pullup/strength values | expand

Commit Message

Jonathan Marek March 4, 2021, 7:48 p.m. UTC
If these fields are not set in dts, the driver will use these variables
uninitialized to set the fields. Not only will it set garbage values for
these fields, but it can overflow into other fields and break those.

In the current sm8250 dts, the dmic01 entries do not have a pullup setting,
and might not work without this change.

Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
---
 drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bjorn Andersson March 5, 2021, 12:05 a.m. UTC | #1
On Thu 04 Mar 13:48 CST 2021, Jonathan Marek wrote:

> If these fields are not set in dts, the driver will use these variables

> uninitialized to set the fields. Not only will it set garbage values for

> these fields, but it can overflow into other fields and break those.

> 

> In the current sm8250 dts, the dmic01 entries do not have a pullup setting,

> and might not work without this change.

> 


Perhaps you didn't see it, but Dan reported this a few days back. So
unless you object I would suggest that we include:

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>


Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>


Regards,
Bjorn

> Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")

> Signed-off-by: Jonathan Marek <jonathan@marek.ca>

> ---

>  drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c

> index 369ee20a7ea95..2f19ab4db7208 100644

> --- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c

> +++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c

> @@ -392,7 +392,7 @@ static int lpi_config_set(struct pinctrl_dev *pctldev, unsigned int group,

>  			  unsigned long *configs, unsigned int nconfs)

>  {

>  	struct lpi_pinctrl *pctrl = dev_get_drvdata(pctldev->dev);

> -	unsigned int param, arg, pullup, strength;

> +	unsigned int param, arg, pullup = LPI_GPIO_BIAS_DISABLE, strength = 2;

>  	bool value, output_enabled = false;

>  	const struct lpi_pingroup *g;

>  	unsigned long sval;

> -- 

> 2.26.1

>
Jonathan Marek March 5, 2021, 12:21 a.m. UTC | #2
On 3/4/21 7:05 PM, Bjorn Andersson wrote:
> On Thu 04 Mar 13:48 CST 2021, Jonathan Marek wrote:

> 

>> If these fields are not set in dts, the driver will use these variables

>> uninitialized to set the fields. Not only will it set garbage values for

>> these fields, but it can overflow into other fields and break those.

>>

>> In the current sm8250 dts, the dmic01 entries do not have a pullup setting,

>> and might not work without this change.

>>

> 

> Perhaps you didn't see it, but Dan reported this a few days back. So

> unless you object I would suggest that we include:

> 


I did not see it. But feel free to add tags.

> Reported-by: kernel test robot <lkp@intel.com>

> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

> 

> 

> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> 

> Regards,

> Bjorn

> 

>> Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")

>> Signed-off-by: Jonathan Marek <jonathan@marek.ca>

>> ---

>>   drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 2 +-

>>   1 file changed, 1 insertion(+), 1 deletion(-)

>>

>> diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c

>> index 369ee20a7ea95..2f19ab4db7208 100644

>> --- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c

>> +++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c

>> @@ -392,7 +392,7 @@ static int lpi_config_set(struct pinctrl_dev *pctldev, unsigned int group,

>>   			  unsigned long *configs, unsigned int nconfs)

>>   {

>>   	struct lpi_pinctrl *pctrl = dev_get_drvdata(pctldev->dev);

>> -	unsigned int param, arg, pullup, strength;

>> +	unsigned int param, arg, pullup = LPI_GPIO_BIAS_DISABLE, strength = 2;

>>   	bool value, output_enabled = false;

>>   	const struct lpi_pingroup *g;

>>   	unsigned long sval;

>> -- 

>> 2.26.1

>>
Srinivas Kandagatla March 5, 2021, 1:10 p.m. UTC | #3
Thanks Jonathan for fixing this!

On 04/03/2021 19:48, Jonathan Marek wrote:
> If these fields are not set in dts, the driver will use these variables

> uninitialized to set the fields. Not only will it set garbage values for

> these fields, but it can overflow into other fields and break those.

> 

> In the current sm8250 dts, the dmic01 entries do not have a pullup setting,

> and might not work without this change.

> 

> Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")

> Signed-off-by: Jonathan Marek <jonathan@marek.ca>

> ---


LGTM,
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>



--srini


>   drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 2 +-

>   1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c

> index 369ee20a7ea95..2f19ab4db7208 100644

> --- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c

> +++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c

> @@ -392,7 +392,7 @@ static int lpi_config_set(struct pinctrl_dev *pctldev, unsigned int group,

>   			  unsigned long *configs, unsigned int nconfs)

>   {

>   	struct lpi_pinctrl *pctrl = dev_get_drvdata(pctldev->dev);

> -	unsigned int param, arg, pullup, strength;

> +	unsigned int param, arg, pullup = LPI_GPIO_BIAS_DISABLE, strength = 2;

>   	bool value, output_enabled = false;

>   	const struct lpi_pingroup *g;

>   	unsigned long sval;

>
Linus Walleij March 10, 2021, 11:13 p.m. UTC | #4
On Thu, Mar 4, 2021 at 8:49 PM Jonathan Marek <jonathan@marek.ca> wrote:

> If these fields are not set in dts, the driver will use these variables

> uninitialized to set the fields. Not only will it set garbage values for

> these fields, but it can overflow into other fields and break those.

>

> In the current sm8250 dts, the dmic01 entries do not have a pullup setting,

> and might not work without this change.

>

> Fixes: 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")

> Signed-off-by: Jonathan Marek <jonathan@marek.ca>


Patch applied for fixes!

Yours,
Linus Walleij
patchwork-bot+linux-arm-msm@kernel.org May 26, 2021, 7:03 p.m. UTC | #5
Hello:

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

On Thu,  4 Mar 2021 14:48:16 -0500 you wrote:
> If these fields are not set in dts, the driver will use these variables

> uninitialized to set the fields. Not only will it set garbage values for

> these fields, but it can overflow into other fields and break those.

> 

> In the current sm8250 dts, the dmic01 entries do not have a pullup setting,

> and might not work without this change.

> 

> [...]


Here is the summary with links:
  - pinctrl: qcom: lpass lpi: use default pullup/strength values
    https://git.kernel.org/qcom/c/2a9be38099e3

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
index 369ee20a7ea95..2f19ab4db7208 100644
--- a/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
+++ b/drivers/pinctrl/qcom/pinctrl-lpass-lpi.c
@@ -392,7 +392,7 @@  static int lpi_config_set(struct pinctrl_dev *pctldev, unsigned int group,
 			  unsigned long *configs, unsigned int nconfs)
 {
 	struct lpi_pinctrl *pctrl = dev_get_drvdata(pctldev->dev);
-	unsigned int param, arg, pullup, strength;
+	unsigned int param, arg, pullup = LPI_GPIO_BIAS_DISABLE, strength = 2;
 	bool value, output_enabled = false;
 	const struct lpi_pingroup *g;
 	unsigned long sval;