Search Linux Wireless

Re: [PATCH v2 5/7] wl12xx: add RX data filter ACX commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Luciano Coelho <coelho@xxxxxx> writes:

> On Mon, 2012-02-06 at 16:07 +0200, Kalle Valo wrote: 
>> Luciano Coelho <coelho@xxxxxx> writes:
>> 
>> >> +	if (index >= WL1271_MAX_RX_DATA_FILTERS) {
>> >> +		wl1271_warning("acx_set_rx_data_filter: invalid filter idx(%d)",
>> >> +			       index);
>> >> +		return -EINVAL;
>> >> +	}
>> >
>> > Should we use BUG_ON instead? This is only used internally in the
>> > driver, so if it get here, it's a bug.  And if the filters come from
>> > userspace, we should validate them before continuing anyway.
>> 
>> BUG_ON() is evil and wireless drivers should really not use it,
>> WARN_ON_ONCE() and return with an error is much more user friendly.
>
> Yeah, BUG_ON() is evil, but sometimes it can be good to have.

What good does BUG_ON() bring compared to WARN_ON_ONCE()? For example,
does BUG_ON() even get logged to disk? Most likely not, so
WARN_ON_ONCE() is much easier to report by the users.

> I don't agree with "wireless drivers should really not use it". There
> are 181 occurrences in wireless-testing/master right now[1].

Then there are 181 misuses of BUG_ON() ;)

> I'm not saying this measure is either accurate or an excuse to use it
> where we shouldn't, but it shows that it really has widespread usage
> in wireless drivers.

Yes, and that's why I have started a war against misuse of BUG_ON() :)

-- 
Kalle Valo
--
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


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux