pos = ieee80211_ie_build_he_cap(pos, he_cap, end);
                if (!pos)
                        goto out_err;
+       }
+
+       if (cfg80211_any_usable_channels(local->hw.wiphy,
+                                        BIT(NL80211_BAND_6GHZ),
+                                        IEEE80211_CHAN_NO_HE)) {
+               struct ieee80211_supported_band *sband6;
+
+               sband6 = local->hw.wiphy->bands[NL80211_BAND_6GHZ];
+               he_cap = ieee80211_get_he_iftype_cap(sband6,
+                               ieee80211_vif_type_p2p(&sdata->vif));
 
-               if (sband->band == NL80211_BAND_6GHZ) {
+               if (he_cap) {
                        enum nl80211_iftype iftype =
                                ieee80211_vif_type_p2p(&sdata->vif);
                        __le16 cap = ieee80211_get_he_6ghz_capa(sband, iftype);