mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
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>
This commit is contained in:
parent
55db64ddd6
commit
428ea708b7
|
|
@ -11011,7 +11011,9 @@ static int rt2800_validate_eeprom(struct rt2x00_dev *rt2x00dev)
|
|||
* Start validation of the data that has been read.
|
||||
*/
|
||||
mac = rt2800_eeprom_addr(rt2x00dev, EEPROM_MAC_ADDR_0);
|
||||
rt2x00lib_set_mac_address(rt2x00dev, mac);
|
||||
retval = rt2x00lib_set_mac_address(rt2x00dev, mac);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
word = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF0);
|
||||
if (word == 0xffff) {
|
||||
|
|
|
|||
|
|
@ -1427,7 +1427,7 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
|
|||
*/
|
||||
u32 rt2x00lib_get_bssidx(struct rt2x00_dev *rt2x00dev,
|
||||
struct ieee80211_vif *vif);
|
||||
void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr);
|
||||
int rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr);
|
||||
|
||||
/*
|
||||
* Interrupt context handlers.
|
||||
|
|
|
|||
|
|
@ -988,14 +988,20 @@ static void rt2x00lib_rate(struct ieee80211_rate *entry,
|
|||
entry->flags |= IEEE80211_RATE_SHORT_PREAMBLE;
|
||||
}
|
||||
|
||||
void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr)
|
||||
int rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr)
|
||||
{
|
||||
of_get_mac_address(rt2x00dev->dev->of_node, eeprom_mac_addr);
|
||||
int ret;
|
||||
|
||||
ret = of_get_mac_address(rt2x00dev->dev->of_node, eeprom_mac_addr);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
return ret;
|
||||
|
||||
if (!is_valid_ether_addr(eeprom_mac_addr)) {
|
||||
eth_random_addr(eeprom_mac_addr);
|
||||
rt2x00_eeprom_dbg(rt2x00dev, "MAC: %pM\n", eeprom_mac_addr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rt2x00lib_set_mac_address);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user