Mingyen Hsieh <mingyen.hsieh@xxxxxxxxxxxx> wrote: [...] > > +void mt7925_regd_be_ctrl(struct mt792x_dev *dev, u8 *alpha2) > +{ > + struct mt792x_phy *phy = &dev->phy; > + struct mt7925_clc_rule_v2 *rule; > + struct mt7925_clc *clc; > + bool old = dev->has_eht, new = true; > + u8 *pos; > + > + if (!phy->clc[MT792x_CLC_BE_CTRL]) > + goto out; > + > + clc = (struct mt7925_clc *)phy->clc[MT792x_CLC_BE_CTRL]; > + pos = clc->data; > + > + while (1) { while (1) could lead infinite loop unexpectedly. Adding a checking of clc->len would be safer. > + rule = (struct mt7925_clc_rule_v2 *)pos; > + > + if (rule->alpha2[0] == alpha2[0] && > + rule->alpha2[1] == alpha2[1]) { > + new = false; > + break; > + } > + > + /* Check the last one */ > + if (rule->flag && BIT(0)) > + break; > + > + pos += sizeof(*rule); > + } > + > +out: > + if (old == new) > + return; > + > + dev->has_eht = new; > + mt7925_set_stream_he_eht_caps(phy); > +} > + [...]