Netdev List
 help / color / mirror / Atom feed
From: Luiz Angelo Daros de Luca <luizluca@gmail.com>
To: "Linus Walleij" <linusw@kernel.org>,
	"Alvin Šipraga" <alsi@bang-olufsen.dk>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Michael Rasmussen" <mir@bang-olufsen.dk>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Mieczyslaw Nalewaj" <namiltd@yahoo.com>
Cc: Luiz Angelo Daros de Luca <luizluca@gmail.com>,
	netdev@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: [PATCH net v2 2/4] net: dsa: realtek: use devm_mutex_init for regmap lock
Date: Sun, 26 Jul 2026 22:56:09 -0300	[thread overview]
Message-ID: <20260726-realtek_mutext-v2-2-5d62ba998791@gmail.com> (raw)
In-Reply-To: <20260726-realtek_mutext-v2-0-5d62ba998791@gmail.com>

With CONFIG_DEBUG_MUTEXES enabled, mutex_destroy() needs to be called
before the lock is discarded. Use devm_mutex_init() instead so the
cleanup is handled automatically.

Fixes: 907e772f6f6de ("net: dsa: realtek: allow subdrivers to externally lock regmap")
Reviewed-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
---
 drivers/net/dsa/realtek/rtl83xx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/realtek/rtl83xx.c b/drivers/net/dsa/realtek/rtl83xx.c
index 71124ecca92f..9402bfe4f85a 100644
--- a/drivers/net/dsa/realtek/rtl83xx.c
+++ b/drivers/net/dsa/realtek/rtl83xx.c
@@ -156,7 +156,10 @@ rtl83xx_probe(struct device *dev,
 	if (!priv)
 		return ERR_PTR(-ENOMEM);
 
-	mutex_init(&priv->map_lock);
+	ret = devm_mutex_init(dev, &priv->map_lock);
+	if (ret)
+		return ERR_PTR(ret);
+
 	mutex_init(&priv->vlan_lock);
 	mutex_init(&priv->l2_lock);
 

-- 
2.55.0


  parent reply	other threads:[~2026-07-27  1:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27  1:56 [PATCH net v2 0/4] net: dsa: realtek: use devm_mutex_init Luiz Angelo Daros de Luca
2026-07-27  1:56 ` [PATCH net v2 1/4] net: dsa: realtek: rtl8365mb: use devm_mutex_init for mib_lock Luiz Angelo Daros de Luca
2026-07-27  1:56 ` Luiz Angelo Daros de Luca [this message]
2026-07-27  1:56 ` [PATCH net v2 3/4] net: dsa: realtek: use devm_mutex_init for vlan_lock Luiz Angelo Daros de Luca
2026-07-27  1:56 ` [PATCH net v2 4/4] net: dsa: realtek: use devm_mutex_init for l2_lock Luiz Angelo Daros de Luca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260726-realtek_mutext-v2-2-5d62ba998791@gmail.com \
    --to=luizluca@gmail.com \
    --cc=alsi@bang-olufsen.dk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mir@bang-olufsen.dk \
    --cc=namiltd@yahoo.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox