Skip to contentSkip to conversation

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

PATCH Applied Jonathan Marek 5 participants 6 messages Mar 4, 2021 – May 26, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

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

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")
---
 drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +1 -1
index 369ee20a7ea95..2f19ab4db7208 100644
@@ -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;
Signature · 1 line
2.26.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jonathan Marek

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:

Regards,
Bjorn

Quoted 22 lines
Fixes 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")
---
 drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +1 -1
index 369ee20a7ea95..2f19ab4db7208 100644
@@ -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;
Signature · 1 line
2.26.1
#2 lore raw
Quoted 6 lines · Bjorn Andersson
Quoted 4 lines · Jonathan Marek

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.

Quoted 7 lines
Quoted 3 lines

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.

Quoted 31 lines

Regards,
Bjorn

Quoted 22 lines
Fixes 6e261d1090d6 ("pinctrl: qcom: Add sm8250 lpass lpi pinctrl driver")
---
  drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +1 -1
index 369ee20a7ea95..2f19ab4db7208 100644
@@ -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;
Signature · 1 line
2.26.1
Reviewed-by on v1 1/1
#3 lore raw
In reply to Jonathan Marek

Thanks Jonathan for fixing this!

Quoted 10 lines · Jonathan Marek

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")

---

LGTM,

--srini

Quoted 17 lines
  drivers/pinctrl/qcom/pinctrl-lpass-lpi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-lpass-lpi.c +1 -1
index 369ee20a7ea95..2f19ab4db7208 100644
@@ -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;
#4 lore raw
In reply to Jonathan Marek
Quoted 9 lines · Jonathan Marek

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")

Patch applied for fixes!

Yours,
Linus Walleij

#5 lore raw
In reply to Jonathan Marek
This patch was applied to qcom/linux.git (refs/heads/for-next):

Hello:

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

Quoted 8 lines · 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