qtnfmac: fix invalid channel information output
authorSergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Wed, 13 Nov 2019 11:06:51 +0000 (11:06 +0000)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 14 Nov 2019 15:28:49 +0000 (17:28 +0200)
Do not attempt to print frequency for an invalid channel
provided by firmware. That channel may simply not exist.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/quantenna/qtnfmac/event.c

index b57c8c18a8d01b0d2939dfa427002aea1335a17e..7846383c88283fef3719dbda9200b4b635342740 100644 (file)
@@ -171,8 +171,9 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif,
                return -EPROTO;
        }
 
-       pr_debug("VIF%u.%u: BSSID:%pM status:%u\n",
-                vif->mac->macid, vif->vifid, join_info->bssid, status);
+       pr_debug("VIF%u.%u: BSSID:%pM chan:%u status:%u\n",
+                vif->mac->macid, vif->vifid, join_info->bssid,
+                le16_to_cpu(join_info->chan.chan.center_freq), status);
 
        if (status != WLAN_STATUS_SUCCESS)
                goto done;
@@ -181,7 +182,7 @@ qtnf_event_handle_bss_join(struct qtnf_vif *vif,
        if (!cfg80211_chandef_valid(&chandef)) {
                pr_warn("MAC%u.%u: bad channel freq=%u cf1=%u cf2=%u bw=%u\n",
                        vif->mac->macid, vif->vifid,
-                       chandef.chan->center_freq,
+                       chandef.chan ? chandef.chan->center_freq : 0,
                        chandef.center_freq1,
                        chandef.center_freq2,
                        chandef.width);