]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: dsa: ksz: ksz8863_smi_probe: set proper return value for ksz_switch_alloc()
authorOleksij Rempel <o.rempel@pengutronix.de>
Thu, 29 Apr 2021 11:08:33 +0000 (13:08 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Apr 2021 22:54:35 +0000 (15:54 -0700)
ksz_switch_alloc() will return NULL only if allocation is failed. So,
the proper return value is -ENOMEM.

Fixes: 2555630ed86f ("net: dsa: microchip: Add Microchip KSZ8863 SMI based driver support")
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/microchip/ksz8863_smi.c

index 9fb38e99001a43941b4e5a53366af9d8530ef3d3..11293485138c260a2eec63772f74d613a39a40a6 100644 (file)
@@ -154,7 +154,7 @@ static int ksz8863_smi_probe(struct mdio_device *mdiodev)
 
        dev = ksz_switch_alloc(&mdiodev->dev, ksz8);
        if (!dev)
-               return -EINVAL;
+               return -ENOMEM;
 
        for (i = 0; i < ARRAY_SIZE(ksz8863_regmap_config); i++) {
                rc = ksz8863_regmap_config[i];