Skip to content

Commit 8d93ff4

Browse files
CraftyChimerakuba-moo
authored andcommitted
net: usb: lan78xx: fix use of improperly initialized dev->chipid in lan78xx_reset
dev->chipid is used in lan78xx_init_mac_address before it's initialized: lan78xx_reset() { lan78xx_init_mac_address() lan78xx_read_eeprom() lan78xx_read_raw_eeprom() <- dev->chipid is used here dev->chipid = ... <- dev->chipid is initialized correctly here } Reorder initialization so that dev->chipid is set before calling lan78xx_init_mac_address(). Fixes: a0db7d1 ("lan78xx: Add to handle mux control per chip id") Signed-off-by: I Viswanath <[email protected]> Reviewed-by: Vadim Fedorenko <[email protected]> Reviewed-by: Khalid Aziz <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5e655aa commit 8d93ff4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/usb/lan78xx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,10 +3250,6 @@ static int lan78xx_reset(struct lan78xx_net *dev)
32503250
}
32513251
} while (buf & HW_CFG_LRST_);
32523252

3253-
ret = lan78xx_init_mac_address(dev);
3254-
if (ret < 0)
3255-
return ret;
3256-
32573253
/* save DEVID for later usage */
32583254
ret = lan78xx_read_reg(dev, ID_REV, &buf);
32593255
if (ret < 0)
@@ -3262,6 +3258,10 @@ static int lan78xx_reset(struct lan78xx_net *dev)
32623258
dev->chipid = (buf & ID_REV_CHIP_ID_MASK_) >> 16;
32633259
dev->chiprev = buf & ID_REV_CHIP_REV_MASK_;
32643260

3261+
ret = lan78xx_init_mac_address(dev);
3262+
if (ret < 0)
3263+
return ret;
3264+
32653265
/* Respond to the IN token with a NAK */
32663266
ret = lan78xx_read_reg(dev, USB_CFG0, &buf);
32673267
if (ret < 0)

0 commit comments

Comments
 (0)