diff mbox series

mt76: fix possible undetected invalid MAC address

Message ID 20191126131554.32457-1-shayne.chen@mediatek.com (mailing list archive)
State Accepted
Delegated to: Felix Fietkau
Headers show
Series mt76: fix possible undetected invalid MAC address | expand

Commit Message

Shayne Chen Nov. 26, 2019, 1:15 p.m. UTC
Make sure the MAC address is checked before function returns.

If CONFIG_OF is set and the device node is null, the function will 
return directly, and an invalid MAC address will not be checked.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/eeprom.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c
index 804224e81103..358fb0a1e523 100644
--- a/drivers/net/wireless/mediatek/mt76/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/eeprom.c
@@ -80,13 +80,14 @@  mt76_eeprom_override(struct mt76_dev *dev)
 	const u8 *mac;
 
 	if (!np)
-		return;
+		goto out;
 
 	mac = of_get_mac_address(np);
 	if (!IS_ERR(mac))
 		ether_addr_copy(dev->macaddr, mac);
 #endif
 
+out:
 	if (!is_valid_ether_addr(dev->macaddr)) {
 		eth_random_addr(dev->macaddr);
 		dev_info(dev->dev,