net: dsa: mv88e6xxx: Handle error in serdes_get_regs
authorChris Packham <chris.packham@alliedtelesis.co.nz>
Tue, 24 Nov 2020 04:34:40 +0000 (17:34 +1300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 26 Nov 2020 01:58:06 +0000 (17:58 -0800)
commit0fd5d79efa4a35c5b0944f7dc42b440d56af4b04
treee7c16fdd4ae99b95e9f42f3ce9628c0c9f08ff10
parent5c19bc8b57342768087d4ca2f3b29cb69e7dcdfb
net: dsa: mv88e6xxx: Handle error in serdes_get_regs

If the underlying read operation failed we would end up writing stale
data to the supplied buffer. This would end up with the last
successfully read value repeating. Fix this by only writing the data
when we know the read was good. This will mean that failed values will
return 0xffff.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/mv88e6xxx/serdes.c