From: Vivien Didelot Date: Wed, 28 Aug 2019 16:26:11 +0000 (-0400) Subject: net: dsa: mv88e6xxx: get serdes lane after lock X-Git-Tag: microblaze-v5.5-rc1~160^2~123 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=b98f0f530d7978157b553a97556c5cc6489b3108;p=linux-2.6-microblaze.git net: dsa: mv88e6xxx: get serdes lane after lock This is a follow-up patch for commit 17deaf5cb37a ("net: dsa: mv88e6xxx: create serdes_get_lane chip operation"). The .serdes_get_lane implementations access the CMODE of a port, even though it is cached at the moment, it is safer to call them after the mutex is locked, not before. At the same time, check for an eventual error and return IRQ_DONE, instead of blindly ignoring it. Signed-off-by: Vivien Didelot Reviewed-by: Marek BehĂșn Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller --- diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c index 9424e401dbc7..38c0da2492c0 100644 --- a/drivers/net/dsa/mv88e6xxx/serdes.c +++ b/drivers/net/dsa/mv88e6xxx/serdes.c @@ -646,10 +646,12 @@ static irqreturn_t mv88e6390_serdes_thread_fn(int irq, void *dev_id) int err; u8 lane; - mv88e6xxx_serdes_get_lane(chip, port->port, &lane); - mv88e6xxx_reg_lock(chip); + err = mv88e6xxx_serdes_get_lane(chip, port->port, &lane); + if (err) + goto out; + switch (cmode) { case MV88E6XXX_PORT_STS_CMODE_SGMII: case MV88E6XXX_PORT_STS_CMODE_1000BASEX: