]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: dsa: mv88e6xxx: handle unknown duplex modes gracefully in mv88e6xxx_port_set_duplex
authorHeiner Kallweit <hkallweit1@gmail.com>
Fri, 1 Mar 2019 18:53:57 +0000 (19:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Mar 2019 21:03:07 +0000 (14:03 -0700)
[ Upstream commit c6195a8bdfc62a7cecf7df685e64847a4b700275 ]

When testing another issue I faced the problem that
mv88e6xxx_port_setup_mac() failed due to DUPLEX_UNKNOWN being passed
as argument to mv88e6xxx_port_set_duplex(). We should handle this case
gracefully and return -EOPNOTSUPP, like e.g. mv88e6xxx_port_set_speed()
is doing it.

Fixes: 7f1ae07b51e8 ("net: dsa: mv88e6xxx: add port duplex setter")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/dsa/mv88e6xxx/port.c

index a7801f6668a5d0e394fd01078bb10c50998cdf56..2cffecfe86e3bbc97a973723216c25ee248e7fa3 100644 (file)
@@ -165,7 +165,7 @@ int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup)
                /* normal duplex detection */
                break;
        default:
-               return -EINVAL;
+               return -EOPNOTSUPP;
        }
 
        err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_MAC_CTL, reg);