From patchwork Thu Jun 4 20:35:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 1303739 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=konsulko.com Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49dHbZ462Lz9sSd for ; Fri, 5 Jun 2020 06:35:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B28D680929; Thu, 4 Jun 2020 22:35:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 7B46280A01; Thu, 4 Jun 2020 22:35:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SUBJ_OBFU_PUNCT_FEW,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from mail-qv1-f68.google.com (mail-qv1-f68.google.com [209.85.219.68]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CFC09808E0 for ; Thu, 4 Jun 2020 22:35:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=tom.rini@gmail.com Received: by mail-qv1-f68.google.com with SMTP id z9so3613586qvi.12 for ; Thu, 04 Jun 2020 13:35:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=uox+lVkg4xS7NlxxzQj+jpKZRg5w3XghlrmDst+a2A0=; b=YBVPEh/6EcgNRkBS5LyUogvIzpuGcq11SeyTd2ndT+QrFGL3jcWJAqs5rztaEik3kP xWv/B5BjZ/vW8GpsQf12WkOkvSpckHqnvCa8ZZo3T4T/iaF61hUc9+0qPu7YfgUcU9f3 zKSHxkzbQyw8tIDN7zqSj5+R8sJNKSD26Oxacckn116Dds0he+zwp4wqZ2MTrWbxLjWq 1Jqwa+sYsKkpkLHCKcOb3vwQYd4GDHHCcvYpb0XoJg80IHuVJrGs6J+StRcknkcFRXGq RaI+TD0/YznvwPOMERxIoVf8y85iDAhr+Ek5fUgTPYOnIAnCBk38mDLZWo1PhZBWeEZZ wI9A== X-Gm-Message-State: AOAM530L7x7AjdAv9b+LLtO+0njkOYwEpGhGp645lBn8+GAgHoP1chdx V2hQ3UYZmuxE6QTurYBHAcgfg1TIAg== X-Google-Smtp-Source: ABdhPJwBMhIOM6DPPfCXatcYtG7SWxk5cLGec8RZss/DS1a/Yv1L+kPJIHpAW9PBPWh/i2IZBY0HBw== X-Received: by 2002:ad4:472f:: with SMTP id l15mr6591944qvz.52.1591302920146; Thu, 04 Jun 2020 13:35:20 -0700 (PDT) Received: from bill-the-cat.local (2606-a000-1401-826f-79c7-9e70-bb1f-ea59.inf6.spectrum.com. [2606:a000:1401:826f:79c7:9e70:bb1f:ea59]) by smtp.gmail.com with ESMTPSA id 79sm5150176qkf.48.2020.06.04.13.35.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2020 13:35:19 -0700 (PDT) From: Tom Rini To: u-boot@lists.denx.de Cc: Marek Vasut Subject: [PATCH] usb: eth: lan78xx: Fix logic in lan78xx_read_otp() to avoid a warning Date: Thu, 4 Jun 2020 16:35:15 -0400 Message-Id: <20200604203515.12971-1-trini@konsulko.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean 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 Signed-off-by: Tom Rini Reviewed-by: Marek Vasut --- 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)