net: dsa: realtek: use devm_mutex_init for regmap lock

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: 907e772f6f ("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>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
Link: https://patch.msgid.link/20260726-realtek_mutext-v2-2-5d62ba998791@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Luiz Angelo Daros de Luca
2026-07-26 22:56:09 -03:00
committed by Jakub Kicinski
parent 70fd0cf29b
commit 050e07f876

View File

@@ -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);