Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/aQSz_euUg0Ja8ZaH@stanley.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Dan Carpenter and committed by
Jakub Kicinski
c79a0225 dfb073d3

+1 -1
+1 -1
drivers/net/dsa/microchip/ksz9477.c
··· 244 244 p->phydev.link = 0; 245 245 } 246 246 } else if (reg == MII_BMSR) { 247 - p->phydev.link = (val & BMSR_LSTATUS); 247 + p->phydev.link = !!(val & BMSR_LSTATUS); 248 248 } 249 249 } 250 250