From: Su Hui <suhui@nfschina.com>
To: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, nathan@kernel.org, ndesaulniers@google.com,
trix@redhat.com
Cc: Su Hui <suhui@nfschina.com>,
netdev@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
kernel-janitors@vger.kernel.org
Subject: [PATCH] net: lan78xx: add an error code check in lan78xx_write_raw_eeprom
Date: Thu, 19 Oct 2023 16:40:23 +0800 [thread overview]
Message-ID: <20231019084022.1528885-1-suhui@nfschina.com> (raw)
check the value of 'ret' after call 'lan78xx_read_reg'.
Signed-off-by: Su Hui <suhui@nfschina.com>
---
Clang complains that value stored to 'ret' is never read.
Maybe this place miss an error code check, I'm not sure
about this.
drivers/net/usb/lan78xx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 59cde06aa7f6..347788336b11 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -977,6 +977,10 @@ static int lan78xx_write_raw_eeprom(struct lan78xx_net *dev, u32 offset,
* disable & restore LED function to access EEPROM.
*/
ret = lan78xx_read_reg(dev, HW_CFG, &val);
+ if (ret < 0) {
+ retval = -EIO;
+ goto exit;
+ }
saved = val;
if (dev->chipid == ID_REV_CHIP_ID_7800_) {
val &= ~(HW_CFG_LED1_EN_ | HW_CFG_LED0_EN_);
--
2.30.2
next reply other threads:[~2023-10-19 8:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-19 8:40 Su Hui [this message]
2023-10-19 10:34 ` [PATCH] net: lan78xx: add an error code check in lan78xx_write_raw_eeprom Dan Carpenter
2023-10-20 2:59 ` Su Hui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231019084022.1528885-1-suhui@nfschina.com \
--to=suhui@nfschina.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=trix@redhat.com \
--cc=woojung.huh@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox