]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: eth: lan78xx: Fix logic in lan78xx_read_otp() to avoid a warning
authorTom Rini <trini@konsulko.com>
Thu, 4 Jun 2020 20:35:15 +0000 (16:35 -0400)
committerTom Rini <trini@konsulko.com>
Tue, 20 Jun 2023 17:02:59 +0000 (13:02 -0400)
In lan78xx_read_otp() we want to know if sig is LAN78XX_OTP_INDICATOR_1
or LAN78XX_OTP_INDICATOR_2.  In the case of matching the first one we
set offset to itself, and clang warns about this.  Rework the logic so
that if sig is the second indicator we adjust the offset as today and if
it does not match the first indicator we return -EINVAL

Cc: Marek Vasut <marex@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Tom Rini <trini@konsulko.com>
drivers/usb/eth/lan78xx.c

index 37912a1d0400c5767b553b34a0fb12f505dc371d..1d8267c80bb572a2937b1b6e8843189ca95488db 100644 (file)
@@ -146,11 +146,9 @@ static int lan78xx_read_otp(struct usb_device *udev, u32 offset,
        ret = lan78xx_read_raw_otp(udev, 0, 1, &sig);
 
        if (!ret) {
-               if (sig == LAN78XX_OTP_INDICATOR_1)
-                       offset = offset;
-               else if (sig == LAN78XX_OTP_INDICATOR_2)
+               if (sig == LAN78XX_OTP_INDICATOR_2)
                        offset += 0x100;
-               else
+               else if (sig != LAN78XX_OTP_INDICATOR_1)
                        return -EINVAL;
                ret = lan78xx_read_raw_otp(udev, offset, length, data);
                if (ret)