All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: eth: lan78xx: Fix logic in lan78xx_read_otp() to avoid a warning
@ 2020-06-04 20:35 Tom Rini
  2020-06-04 20:41 ` Marek Vasut
  2023-06-20 18:15 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Rini @ 2020-06-04 20:35 UTC (permalink / raw)
  To: u-boot

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>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
 drivers/usb/eth/lan78xx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/eth/lan78xx.c b/drivers/usb/eth/lan78xx.c
index e34ad2603fbb..d147412990de 100644
--- a/drivers/usb/eth/lan78xx.c
+++ b/drivers/usb/eth/lan78xx.c
@@ -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)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] usb: eth: lan78xx: Fix logic in lan78xx_read_otp() to avoid a warning
  2020-06-04 20:35 [PATCH] usb: eth: lan78xx: Fix logic in lan78xx_read_otp() to avoid a warning Tom Rini
@ 2020-06-04 20:41 ` Marek Vasut
  2023-06-20 18:15 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2020-06-04 20:41 UTC (permalink / raw)
  To: u-boot

On 6/4/20 10:35 PM, Tom Rini wrote:
> 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>
> Signed-off-by: Tom Rini <trini@konsulko.com>

Reviewed-by: Marek Vasut <marex@denx.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: eth: lan78xx: Fix logic in lan78xx_read_otp() to avoid a warning
  2020-06-04 20:35 [PATCH] usb: eth: lan78xx: Fix logic in lan78xx_read_otp() to avoid a warning Tom Rini
  2020-06-04 20:41 ` Marek Vasut
@ 2023-06-20 18:15 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2023-06-20 18:15 UTC (permalink / raw)
  To: u-boot, Tom Rini

On Thu, 04 Jun 2020 16:35:15 -0400, Tom Rini wrote:

> 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
> 
> 
> [...]

Applied to u-boot/next, thanks!

-- 
Tom


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-20 18:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 20:35 [PATCH] usb: eth: lan78xx: Fix logic in lan78xx_read_otp() to avoid a warning Tom Rini
2020-06-04 20:41 ` Marek Vasut
2023-06-20 18:15 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.