On Tue, 2017-09-05 at 16:30 +0200, Johannes Berg wrote:
> On Sat, 2017-08-05 at 11:44 +0300, Luca Coelho wrote:
>
> > + regd = get_wiphy_regdom(wiphy);
> > + if (regd) {
> > + const struct ieee80211_reg_rule *reg_rule =
> > + freq_reg_info_regd(MHZ_TO_KHZ(channel-
> > > center_freq),
> >
> > + regd, MHZ_TO_KHZ(20));
> >
>
> This could return an error, how can you be sure it doesn't?
>
Hm... so I guess I could check that it didn't return any error and if
it did, then flags = 0?
Something like this? (on top of this patch):
@@ -1506,15 +1506,15 @@ static void reg_process_ht_flags_channel(struct wiphy
*wiphy,
channel_after = c;
}
+ flags = 0;
regd = get_wiphy_regdom(wiphy);
if (regd) {
const struct ieee80211_reg_rule *reg_rule =
freq_reg_info_regd(MHZ_TO_KHZ(channel->center_freq),
regd, MHZ_TO_KHZ(20));
- flags = reg_rule->flags;
- } else {
- flags = 0;
+ if (!IS_ERR(reg_rule))
+ flags = reg_rule->flags;
}
/*