Thread (21 messages) 21 messages, 8 authors, 2026-01-18

Re: [PATCH 09/11] pinctrl: tegra-xusb: Simplify locking with guard()

From: Jon Hunter <jonathanh@nvidia.com>
Date: 2026-01-14 15:51:50
Also in: linux-aspeed, linux-gpio, linux-rockchip, linux-tegra, lkml, openbmc

On 14/01/2026 15:30, Krzysztof Kozlowski wrote:
quoted hunk ↗ jump to hunk
Simplify error handling (less gotos) over locks with guard().

Signed-off-by: Krzysztof Kozlowski <redacted>
---
  drivers/pinctrl/tegra/pinctrl-tegra-xusb.c | 14 +++++---------
  1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c
index 34a373f7e04d..855f708ce510 100644
--- a/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c
+++ b/drivers/pinctrl/tegra/pinctrl-tegra-xusb.c
@@ -478,10 +478,10 @@ static void tegra_xusb_padctl_enable(struct tegra_xusb_padctl *padctl)
  {
  	u32 value;
  
-	mutex_lock(&padctl->lock);
+	guard(mutex)(&padctl->lock);
  
  	if (padctl->enable++ > 0)
-		goto out;
+		return;
  
  	value = padctl_readl(padctl, XUSB_PADCTL_ELPG_PROGRAM);
  	value &= ~XUSB_PADCTL_ELPG_PROGRAM_AUX_MUX_LP0_CLAMP_EN;
@@ -499,7 +499,6 @@ static void tegra_xusb_padctl_enable(struct tegra_xusb_padctl *padctl)
  	value &= ~XUSB_PADCTL_ELPG_PROGRAM_AUX_MUX_LP0_VCORE_DOWN;
  	padctl_writel(padctl, value, XUSB_PADCTL_ELPG_PROGRAM);
  
-out:
  	mutex_unlock(&padctl->lock);
  }

I believe we need to remove the above unlock too?

Jon

-- 
nvpublic

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help