]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: mt7530: correct ds->num_ports
authorDENG Qingfang <dqfext@gmail.com>
Sat, 16 Oct 2021 06:24:14 +0000 (14:24 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 Oct 2021 12:22:21 +0000 (13:22 +0100)
Setting ds->num_ports to DSA_MAX_PORTS made DSA core allocate unnecessary
dsa_port's and call mt7530_port_disable for non-existent ports.

Set it to MT7530_NUM_PORTS to fix that, and dsa_is_user_port check in
port_enable/disable is no longer required.

Cc: stable@vger.kernel.org
Signed-off-by: DENG Qingfang <dqfext@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mt7530.c

index 094737e5084a49bd5e8ad66381a42df76a952baa..9890672a206d0b1ca0cf575d04d770f9d48abe66 100644 (file)
@@ -1035,9 +1035,6 @@ mt7530_port_enable(struct dsa_switch *ds, int port,
 {
        struct mt7530_priv *priv = ds->priv;
 
-       if (!dsa_is_user_port(ds, port))
-               return 0;
-
        mutex_lock(&priv->reg_mutex);
 
        /* Allow the user port gets connected to the cpu port and also
@@ -1060,9 +1057,6 @@ mt7530_port_disable(struct dsa_switch *ds, int port)
 {
        struct mt7530_priv *priv = ds->priv;
 
-       if (!dsa_is_user_port(ds, port))
-               return;
-
        mutex_lock(&priv->reg_mutex);
 
        /* Clear up all port matrix which could be restored in the next
@@ -3211,7 +3205,7 @@ mt7530_probe(struct mdio_device *mdiodev)
                return -ENOMEM;
 
        priv->ds->dev = &mdiodev->dev;
-       priv->ds->num_ports = DSA_MAX_PORTS;
+       priv->ds->num_ports = MT7530_NUM_PORTS;
 
        /* Use medatek,mcm property to distinguish hardware type that would
         * casues a little bit differences on power-on sequence.