net: dsa: realtek: use devm_mutex_init for vlan_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: 9da2c8672f ("net: dsa: realtek: rtl8365mb: add VLAN support")
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-3-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:10 -03:00
committed by Jakub Kicinski
parent 050e07f876
commit a95f3e9b89

View File

@@ -160,7 +160,10 @@ rtl83xx_probe(struct device *dev,
if (ret)
return ERR_PTR(ret);
mutex_init(&priv->vlan_lock);
ret = devm_mutex_init(dev, &priv->vlan_lock);
if (ret)
return ERR_PTR(ret);
mutex_init(&priv->l2_lock);
rc.lock_arg = priv;