Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: rt2x00: check retval for of_get_mac_address

of_get_mac_address can return -EPROBE_DEFER when nvmem is not probed yet
for whatever reason. In this case, nvmem mac assignments will not work.

Based on the function path, this change only has effect for rt2800soc.c
and rt2800pci.c. The former tends to use nvmem for assignments.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Link: https://patch.msgid.link/20251014050833.46377-1-rosenp@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Rosen Penev and committed by
Johannes Berg
428ea708 55db64dd

+12 -4
+3 -1
drivers/net/wireless/ralink/rt2x00/rt2800lib.c
··· 11011 11011 * Start validation of the data that has been read. 11012 11012 */ 11013 11013 mac = rt2800_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0); 11014 - rt2x00lib_set_mac_address(rt2x00dev, mac); 11014 + retval = rt2x00lib_set_mac_address(rt2x00dev, mac); 11015 + if (retval) 11016 + return retval; 11015 11017 11016 11018 word = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0); 11017 11019 if (word == 0xffff) {
+1 -1
drivers/net/wireless/ralink/rt2x00/rt2x00.h
··· 1427 1427 */ 1428 1428 u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev, 1429 1429 struct ieee80211_vif *vif); 1430 - void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr); 1430 + int rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr); 1431 1431 1432 1432 /* 1433 1433 * Interrupt context handlers.
+8 -2
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
··· 988 988 entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE; 989 989 } 990 990 991 - void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr) 991 + int rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr) 992 992 { 993 - of_get_mac_address(rt2x00dev->dev->of_node, eeprom_mac_addr); 993 + int ret; 994 + 995 + ret = of_get_mac_address(rt2x00dev->dev->of_node, eeprom_mac_addr); 996 + if (ret == -EPROBE_DEFER) 997 + return ret; 994 998 995 999 if (!is_valid_ether_addr(eeprom_mac_addr)) { 996 1000 eth_random_addr(eeprom_mac_addr); 997 1001 rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", eeprom_mac_addr); 998 1002 } 1003 + 1004 + return 0; 999 1005 } 1000 1006 EXPORT_SYMBOL_GPL(rt2x00lib_set_mac_address); 1001 1007