Skip to content
  • Dan Carpenter's avatar
    735b2673
    cfg80211: regulatory: remove a bogus initialization · 735b2673
    Dan Carpenter authored
    
    
    The the __freq_reg_info() never returns NULL and the callers don't check
    for NULL.  This initialization to set "reg_rule = NULL;" is just there
    to make GCC happy but it's not required in current GCCs.
    
    The problem is that Smatch sees the initialization and concludes that
    this function can return NULL so it complains that the callers are not
    checking for it.
    
    Smatch used to be able to parse this correctly but we recently changed
    the code from:
    
    -       for (bw = MHZ_TO_KHZ(20); bw >= min_bw; bw = bw / 2) {
    +       for (bw = MHZ_TO_KHZ(bws[i]); bw >= min_bw; bw = MHZ_TO_KHZ(bws[i--])) {
    
    Originally Smatch used to understand that this code always iterates
    through the loop once, but the change from "MHZ_TO_KHZ(20)" to
    "MHZ_TO_KHZ(bws[i])" is too complicated for Smatch.
    
    Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
    Link: https://lore.kernel.org/r/20200923084203.GC1454948@mwanda
    
    
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    735b2673
    cfg80211: regulatory: remove a bogus initialization
    Dan Carpenter authored
    
    
    The the __freq_reg_info() never returns NULL and the callers don't check
    for NULL.  This initialization to set "reg_rule = NULL;" is just there
    to make GCC happy but it's not required in current GCCs.
    
    The problem is that Smatch sees the initialization and concludes that
    this function can return NULL so it complains that the callers are not
    checking for it.
    
    Smatch used to be able to parse this correctly but we recently changed
    the code from:
    
    -       for (bw = MHZ_TO_KHZ(20); bw >= min_bw; bw = bw / 2) {
    +       for (bw = MHZ_TO_KHZ(bws[i]); bw >= min_bw; bw = MHZ_TO_KHZ(bws[i--])) {
    
    Originally Smatch used to understand that this code always iterates
    through the loop once, but the change from "MHZ_TO_KHZ(20)" to
    "MHZ_TO_KHZ(bws[i])" is too complicated for Smatch.
    
    Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
    Link: https://lore.kernel.org/r/20200923084203.GC1454948@mwanda
    
    
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Loading