From: Dan Carpenter Date: Fri, 31 Oct 2025 13:05:01 +0000 (+0300) Subject: net: dsa: microchip: Fix a link check in ksz9477_pcs_read() X-Git-Tag: v6.19-rc1~170^2~228 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c79a022524577e486220bc9627ccebc706148c1f;p=thirdparty%2Flinux.git net: dsa: microchip: Fix a link check in ksz9477_pcs_read() The BMSR_LSTATUS define is 0x4 but the "p->phydev.link" variable is a 1 bit bitfield in a u32. Since 4 doesn't fit in 0-1 range it means that ".link" is always set to false. Add a !! to fix this. [Jakub: According to Maxime the phydev struct isn't really used and we should consider removing it completely. So not treating this as a fix.] Signed-off-by: Dan Carpenter Link: https://patch.msgid.link/aQSz_euUg0Ja8ZaH@stanley.mountain Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index d747ea1c41a79..cf67d63777194 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -244,7 +244,7 @@ static int ksz9477_pcs_read(struct mii_bus *bus, int phy, int mmd, int reg) p->phydev.link = 0; } } else if (reg == MII_BMSR) { - p->phydev.link = (val & BMSR_LSTATUS); + p->phydev.link = !!(val & BMSR_LSTATUS); } }