Skip to content

Commit c0e0cd6

Browse files
Phil Elwellgregkh
authored andcommitted
lan78xx: Correctly indicate invalid OTP
[ Upstream commit 4bfc338 ] lan78xx_read_otp tries to return -EINVAL in the event of invalid OTP content, but the value gets overwritten before it is returned and the read goes ahead anyway. Make the read conditional as it should be and preserve the error code. Fixes: 55d7de9 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver") Signed-off-by: Phil Elwell <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2ea541e commit c0e0cd6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/usb/lan78xx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,8 @@ static int lan78xx_read_otp(struct lan78xx_net *dev, u32 offset,
928928
offset += 0x100;
929929
else
930930
ret = -EINVAL;
931-
ret = lan78xx_read_raw_otp(dev, offset, length, data);
931+
if (!ret)
932+
ret = lan78xx_read_raw_otp(dev, offset, length, data);
932933
}
933934

934935
return ret;

0 commit comments

Comments
 (0)