The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 1/2] pinctrl: cs42l43: Fix leaked pm reference on error path
@ 2026-05-08 14:34 Charles Keepax
  2026-05-08 14:34 ` [PATCH 2/2] pinctrl: cs42l43: Fix polarity on debounce Charles Keepax
  2026-05-11 12:35 ` [PATCH 1/2] pinctrl: cs42l43: Fix leaked pm reference on error path Bartosz Golaszewski
  0 siblings, 2 replies; 4+ messages in thread
From: Charles Keepax @ 2026-05-08 14:34 UTC (permalink / raw)
  To: linusw; +Cc: brgl, linux-gpio, linux-kernel, patches

Returning directly if the regmap_update_bits() fails causes a pm runtime
reference to be leaked, let things run to the end of the function
instead.

Fixes: e52c741907fb ("pinctrl: cirrus: cs42l43: use new GPIO line value setter callbacks")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
index 227c37c360e19..3cc1835206077 100644
--- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
+++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
@@ -499,12 +499,10 @@ static int cs42l43_gpio_set(struct gpio_chip *chip, unsigned int offset,
 
 	ret = regmap_update_bits(priv->regmap, CS42L43_GPIO_CTRL1,
 				 BIT(shift), value << shift);
-	if (ret)
-		return ret;
 
 	pm_runtime_put(priv->dev);
 
-	return 0;
+	return ret;
 }
 
 static int cs42l43_gpio_direction_out(struct gpio_chip *chip,
-- 
2.47.3


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

* [PATCH 2/2] pinctrl: cs42l43: Fix polarity on debounce
  2026-05-08 14:34 [PATCH 1/2] pinctrl: cs42l43: Fix leaked pm reference on error path Charles Keepax
@ 2026-05-08 14:34 ` Charles Keepax
  2026-05-11 12:35   ` Bartosz Golaszewski
  2026-05-11 12:35 ` [PATCH 1/2] pinctrl: cs42l43: Fix leaked pm reference on error path Bartosz Golaszewski
  1 sibling, 1 reply; 4+ messages in thread
From: Charles Keepax @ 2026-05-08 14:34 UTC (permalink / raw)
  To: linusw; +Cc: brgl, linux-gpio, linux-kernel, patches

The debounce bit sets a bypass on the debounce rather than enabling it,
as such the current polarity of the debounce is set incorrectly. Invert
the polarity to correct this.

Fixes: d5282a539297 ("pinctrl: cs42l43: Add support for the cs42l43")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
index 3cc1835206077..305233fc19876 100644
--- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
+++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
@@ -343,7 +343,7 @@ static int cs42l43_pin_set_db(struct cs42l43_pin *priv, unsigned int pin,
 
 	return regmap_update_bits(priv->regmap, CS42L43_GPIO_CTRL2,
 				  CS42L43_GPIO1_DEGLITCH_BYP_MASK << pin,
-				  !!us << pin);
+				  !us << pin);
 }
 
 static int cs42l43_pin_config_get(struct pinctrl_dev *pctldev,
-- 
2.47.3


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

* Re: [PATCH 1/2] pinctrl: cs42l43: Fix leaked pm reference on error path
  2026-05-08 14:34 [PATCH 1/2] pinctrl: cs42l43: Fix leaked pm reference on error path Charles Keepax
  2026-05-08 14:34 ` [PATCH 2/2] pinctrl: cs42l43: Fix polarity on debounce Charles Keepax
@ 2026-05-11 12:35 ` Bartosz Golaszewski
  1 sibling, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2026-05-11 12:35 UTC (permalink / raw)
  To: Charles Keepax; +Cc: brgl, linux-gpio, linux-kernel, patches, linusw

On Fri, 8 May 2026 16:34:52 +0200, Charles Keepax
<ckeepax@opensource.cirrus.com> said:
> Returning directly if the regmap_update_bits() fails causes a pm runtime
> reference to be leaked, let things run to the end of the function
> instead.
>
> Fixes: e52c741907fb ("pinctrl: cirrus: cs42l43: use new GPIO line value setter callbacks")
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
>  drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
> index 227c37c360e19..3cc1835206077 100644
> --- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
> +++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
> @@ -499,12 +499,10 @@ static int cs42l43_gpio_set(struct gpio_chip *chip, unsigned int offset,
>
>  	ret = regmap_update_bits(priv->regmap, CS42L43_GPIO_CTRL1,
>  				 BIT(shift), value << shift);
> -	if (ret)
> -		return ret;
>
>  	pm_runtime_put(priv->dev);
>
> -	return 0;
> +	return ret;
>  }
>
>  static int cs42l43_gpio_direction_out(struct gpio_chip *chip,
> --
> 2.47.3
>
>

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

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

* Re: [PATCH 2/2] pinctrl: cs42l43: Fix polarity on debounce
  2026-05-08 14:34 ` [PATCH 2/2] pinctrl: cs42l43: Fix polarity on debounce Charles Keepax
@ 2026-05-11 12:35   ` Bartosz Golaszewski
  0 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2026-05-11 12:35 UTC (permalink / raw)
  To: Charles Keepax; +Cc: brgl, linux-gpio, linux-kernel, patches, linusw

On Fri, 8 May 2026 16:34:53 +0200, Charles Keepax
<ckeepax@opensource.cirrus.com> said:
> The debounce bit sets a bypass on the debounce rather than enabling it,
> as such the current polarity of the debounce is set incorrectly. Invert
> the polarity to correct this.
>
> Fixes: d5282a539297 ("pinctrl: cs42l43: Add support for the cs42l43")
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
>  drivers/pinctrl/cirrus/pinctrl-cs42l43.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
> index 3cc1835206077..305233fc19876 100644
> --- a/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
> +++ b/drivers/pinctrl/cirrus/pinctrl-cs42l43.c
> @@ -343,7 +343,7 @@ static int cs42l43_pin_set_db(struct cs42l43_pin *priv, unsigned int pin,
>
>  	return regmap_update_bits(priv->regmap, CS42L43_GPIO_CTRL2,
>  				  CS42L43_GPIO1_DEGLITCH_BYP_MASK << pin,
> -				  !!us << pin);
> +				  !us << pin);
>  }
>
>  static int cs42l43_pin_config_get(struct pinctrl_dev *pctldev,
> --
> 2.47.3
>
>

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

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

end of thread, other threads:[~2026-05-11 12:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-08 14:34 [PATCH 1/2] pinctrl: cs42l43: Fix leaked pm reference on error path Charles Keepax
2026-05-08 14:34 ` [PATCH 2/2] pinctrl: cs42l43: Fix polarity on debounce Charles Keepax
2026-05-11 12:35   ` Bartosz Golaszewski
2026-05-11 12:35 ` [PATCH 1/2] pinctrl: cs42l43: Fix leaked pm reference on error path Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox