ipq40xx: use devm for mutex_init
authorRosen Penev <rosenp@gmail.com>
Sat, 19 Oct 2024 01:56:30 +0000 (18:56 -0700)
committerRobert Marko <robimarko@gmail.com>
Sat, 2 Nov 2024 11:15:12 +0000 (12:15 +0100)
Avoids having to call mutex_destroy in remove.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16755
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ipq40xx/patches-6.6/706-net-dsa-qca8k-add-IPQ4019-built-in-switch-support.patch

index 20dd345c6997a413c65d15eda64f8fccd23d73d8..9bd5ca515ee5d748e73a1b75538623d1da02ebe1 100644 (file)
@@ -87,7 +87,7 @@ Signed-off-by: Robert Marko <robert.marko@sartura.hr>
                if (!dsa_port_offloads_bridge(dsa_to_port(ds, i), &bridge))
 --- /dev/null
 +++ b/drivers/net/dsa/qca/qca8k-ipq4019.c
-@@ -0,0 +1,946 @@
+@@ -0,0 +1,948 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/*
 + * Copyright (C) 2009 Felix Fietkau <nbd@nbd.name>
@@ -989,7 +989,9 @@ Signed-off-by: Robert Marko <robert.marko@sartura.hr>
 +      priv->ds->num_ports = QCA8K_IPQ4019_NUM_PORTS;
 +      priv->ds->priv = priv;
 +      priv->ds->ops = &qca8k_ipq4019_switch_ops;
-+      mutex_init(&priv->reg_mutex);
++      ret = devm_mutex_init(dev, &priv->reg_mutex);
++      if (ret)
++              return ret;
 +      platform_set_drvdata(pdev, priv);
 +
 +      return dsa_register_switch(priv->ds);