Dear Collegues, I have come to consider BUG_ON generally harmful. The idea of an assert is to prevent a program to execute past a point where its state is known erroneous, thus preventing it from dealing more damage to the data (or hiding the traces of malfunction). The problem is, in kernel this harm has to be balanced against the harm of forced reboot.
The last straw was our softmac tree, where "iwlist eth1 scan" causes a lockup. It is absolutely frivolus and provides no advantages a normal assert has to provide. In fact, doing this impedes debugging. We have to face the situation here. Kernel is not usermode. And its components may be not perfect. We have to continue after software faults. Therefore, we have to stop sprinkling BUG_ON all over the place for no good reason. Thank you for your attention, -- Pete P.S. I am ready to compromise and see some printk's in the patch below, but the most important thing here is not just this particular wart. The important thing is to get ourselves off the BUG_ON needle. diff -urp -X dontdiff linux-2.6.16-rc2/net/ieee80211/ieee80211_geo.c linux-2.6.16-rc2-lem/net/ieee80211/ieee80211_geo.c --- linux-2.6.16-rc2/net/ieee80211/ieee80211_geo.c 2006-01-03 20:03:58.000000000 -0800 +++ linux-2.6.16-rc2-lem/net/ieee80211/ieee80211_geo.c 2006-02-22 18:22:58.000000000 -0800 @@ -50,7 +50,8 @@ int ieee80211_is_valid_channel(struct ie /* Driver needs to initialize the geography map before using * these helper functions */ - BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); + if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0) + return 0; if (ieee->freq_band & IEEE80211_24GHZ_BAND) for (i = 0; i < ieee->geo.bg_channels; i++) @@ -76,7 +79,8 @@ int ieee80211_channel_to_index(struct ie /* Driver needs to initialize the geography map before using * these helper functions */ - BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); + if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0) + return -1; if (ieee->freq_band & IEEE80211_24GHZ_BAND) for (i = 0; i < ieee->geo.bg_channels; i++) @@ -97,7 +101,8 @@ u8 ieee80211_freq_to_channel(struct ieee /* Driver needs to initialize the geography map before using * these helper functions */ - BUG_ON(ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0); + if (ieee->geo.bg_channels == 0 && ieee->geo.a_channels == 0) + return 0; freq /= 100000; - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html