[openwrt/openwrt] wifi-scripts: ucode: iwinfo: skip uninitialized PHYs

LEDE Commits lede-commits at lists.infradead.org
Mon Dec 30 12:28:20 PST 2024


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/12b8d5c83c5235fa7c7be870e979e2de6dd1d3c9

commit 12b8d5c83c5235fa7c7be870e979e2de6dd1d3c9
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Dec 30 18:38:42 2024 +0100

    wifi-scripts: ucode: iwinfo: skip uninitialized PHYs
    
    They show up as null entries in the nl80211 wiphy dump.
    Fixes the following error:
    
    Reference error: left-hand side expression is null
    In find_phy(), file /usr/share/ucode/iwinfo.uc, line 19, byte 11:
      called from function get_max_power (/usr/share/ucode/iwinfo.uc:42:32)
      called from function module (/usr/share/ucode/iwinfo.uc:102:39)
      called from anonymous function (/usr/bin/iwinfo:5:25)
    
     `        if (phy.wiphy == wiphy)`
      Near here ------^
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 .../network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc
index a266092bea..4ce45b21f1 100644
--- a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc
+++ b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/iwinfo.uc
@@ -16,7 +16,7 @@ let wireless_status = ubus.call('network.wireless', 'status');
 
 function find_phy(wiphy) {
 	for (let k,  phy in phys)
-		if (phy.wiphy == wiphy)
+		if (phy && phy.wiphy == wiphy)
 			return phy;
 	return null;
 }




More information about the lede-commits mailing list