Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: lan78xx: add an error code check in lan78xx_write_raw_eeprom
@ 2023-10-19  8:40 Su Hui
  2023-10-19 10:34 ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Su Hui @ 2023-10-19  8:40 UTC (permalink / raw)
  To: woojung.huh, UNGLinuxDriver, davem, edumazet, kuba, pabeni,
	nathan, ndesaulniers, trix
  Cc: Su Hui, netdev, linux-usb, linux-kernel, llvm, kernel-janitors

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


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

end of thread, other threads:[~2023-10-20  2:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-19  8:40 [PATCH] net: lan78xx: add an error code check in lan78xx_write_raw_eeprom Su Hui
2023-10-19 10:34 ` Dan Carpenter
2023-10-20  2:59   ` Su Hui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox