[i2c] [PATCH] of/i2c: don't pass -1 to irq_dispose_mapping, otherwise kernel will oops
Wolfram Sang
w.sang at pengutronix.de
Sat Jul 12 18:22:59 EST 2008
On Fri, Jul 11, 2008 at 11:15:02PM +0400, Anton Vorontsov wrote:
> > 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.
I wonder if -1 is really the safest; even kernel functions related to
irqs are not consistent if "irq" is int or unsigned int. So, -1 could
cause subtle signedness defects.
The whole "no irq" mess really needs to be cleared generally. It just
disturbed me that i2c_core was imposing -1, whilst some other subsystem
may have chosen 0. IMHO, subsystems like i2c should pass irqs
transparently. This is why I submitted the patch for i2c documentation.
All the best,
Wolfram
--
Dipl.-Ing. Wolfram Sang | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20080712/34baa2f1/attachment.pgp>
More information about the Linuxppc-dev
mailing list