Subject: Re: [PATCH] of/i2c: don't pass -1 to irq_dispose_mapping, otherwise kernel will oops

From: Anton Vorontsov <[email-masked]>
Date: Fri, 11 Jul 2008 23:15:02 +0400

On Fri, Jul 11, 2008 at 09:01:10PM +0200, Jochen Friedrich wrote:
> Hi Grant,
> 
> > What is the reason that info.irq is set to -1 in the first place?  This
> > looks like another bug to me.  Does something in the i2c layer depend on
> > the -1 value?
> 
> Nope, it was a bug in the i2c documentation fixed recently:

Nope? I'm looking into i2c-core.c:

.. i2c_new_device(...)
{
	client->irq = info->irq;

Core will blindly pass irq, so clients should ensure that irq contains
correct value. And as far as there is no common scheme of checking that
"there is no irq specified", the most safe option is -1.

> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8e29da9ee8958cc17e27f4053420f1c982614793

-- 
Anton Vorontsov
email: [email-masked]
irc://irc.freenode.net/bd2