Search Linux Wireless

Re: [PATCH v2] NFC: pn544_hci: move the dereference below the NULL test

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

 



Wei Yongjun <weiyj.lk@xxxxxxxxx> writes:

> -	BUG_ON(!info);
> -	BUG_ON(irq != info->i2c_dev->irq);
> +	if (!info || irq != info->i2c_dev->irq) {
> +		WARN_ON_ONCE(1);
> +		return IRQ_NONE;
> +	}

You can even simplify it to this:

if (WARN_ON_ONCE(!info || irq != info->i2c_dev->irq))
	return IRQ_NONE;

I don't know if it matters here but if it's important to know which test
is failing having two different tests makes that easier, as the line
number will be different:

if (WARN_ON_ONCE(!info))
	return IRQ_NONE;

if (WARN_ON_ONCE(irq != info->i2c_dev->irq))
	return IRQ_NONE;

-- 
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 Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux