On 06/16/2011 12:02 AM, Pavel Roskin wrote:
WARN_ON is not enough, as we cannot return a valid index, and the callers will use whatever we return, causing a cascade of oopses and eventually a panic. Signed-off-by: Pavel Roskin<proski@xxxxxxx> --- 0 files changed, 0 insertions(+), 0 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index e33fe79..d117019 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -3108,10 +3108,10 @@ rate_lowest_index(struct ieee80211_supported_band *sband, if (rate_supported(sta, sband->band, i)) return i; - /* warn when we cannot find a rate. */ - WARN_ON(1); + /* If we cannot find any rate, we are in trouble. */ + BUG_ON(1); - return 0; + return -EINVAL; }
I would expect some description what the caller should do when -EINVAL is returned. Could even argue whether you want a BUG_ON or allow the caller (driver) to reset the hardware, reassociate, etc. upon -EINVAL. I am not sure under which circumstances this could happen so there may really be no way out.
Gr. AvS -- Almost nobody dances sober, unless they happen to be insane. -- H.P. Lovecraft -- -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html