Search Linux Wireless

Re: [PATCH 5/8] rfkill: add WARN_ON and BUG_ON paranoia

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

 



On Sunday 03 August 2008, Henrique de Moraes Holschuh wrote:
> On Sun, 03 Aug 2008, Johannes Berg wrote:
> > if (WARN_ON(!nb))
> > 	return -EINVAL;
> 
> I could use the notation above instead of:
> if (foo) {
> 	WARN_ON(1);
> 	return -ERROR;
> }
> 
> Ivo, which one you prefer?  The if() with the condition and WARN on the
> branch, or the if(WARN_ON(condition)) ?

Well my preference is either:

	if (WARN_ON(!nb))
		return -EINVAL;

or

	if (foo) {
		WARN();
		return -EINVAL;
	}

Doesn't really matter which of those 2. But like I said in the other patch,
WARN_ON(1) sounds just ugly. ;)

> > BUG() never returns. Same for all the other places you pointed out.
> 
> Yes.  And I used BUG() on the notify chain calls, because the primitives in
> the kernel code are not doing proper error checking anyway (for speed, I
> suppose)...  they just OOPS.

Ok, if for the notify chain BUG() is standard you can use that there. But the
others are preferably WARN(). :)

Ivo
--
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