lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091209175553.GA25451@pengutronix.de>
Date:	Wed, 9 Dec 2009 18:55:53 +0100
From:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>
To:	Grant Likely <grant.likely@...retlab.ca>
Cc:	akpm@...ux-foundation.org, mm-commits@...r.kernel.org,
	daniel@...aq.de, dbrownell@...rs.sourceforge.net,
	s.hauer@...gutronix.de, spi-devel-general@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org
Subject: Re: + spi-imx-correct-check-for-platform_get_irq-failing.patch
	added to -mm tree

On Wed, Dec 09, 2009 at 04:32:41PM +0100, Uwe Kleine-König wrote:
> On Wed, Dec 09, 2009 at 08:08:19AM -0700, Grant Likely wrote:
> > (resend because I forgot to cc the mailing list)
> > 
> > 2009/12/9 Uwe Kleine-König <u.kleine-koenig@...gutronix.de>:
> > > Hello Grant,
> > >
> > > On Tue, Dec 08, 2009 at 05:38:57PM -0700, Grant Likely wrote:
> > >> > diff -puN drivers/spi/spi_imx.c~spi-imx-correct-check-for-platform_get_irq-failing drivers/spi/spi_imx.c
> > >> > --- a/drivers/spi/spi_imx.c~spi-imx-correct-check-for-platform_get_irq-failing
> > >> > +++ a/drivers/spi/spi_imx.c
> > >> > @@ -554,7 +554,7 @@ static int __init spi_imx_probe(struct p
> > >> >        }
> > >> >
> > >> >        spi_imx->irq = platform_get_irq(pdev, 0);
> > >> > -       if (!spi_imx->irq) {
> > >> > +       if (spi_imx->irq < 0) {
> > >>
> > >> This changes the old behaviour.  Is that what you intended?  '<= 0' perhaps?
> > > Yes, the old check was wrong.  What if the irq to use is 0?  I thought
> > > the commit log to be understandable.  platform_get_irq returns -ENXIO on
> > > error and an irq number on success.  So 0 has to be interpreted as valid
> > > irq, not an error.
> > 
> > 0 is not a valid IRQ
> Hmm, on my x86 I have:
> 
> 	$ grep '\<0:' /proc/interrupts 
> 	   0:      24330   IO-APIC-edge      timer
> 
> arm/davinci starts at 0, too.  As does arm/ns9xxx.  arm/pxa seems to
> start at 1.  realview starts at 1, too.  So four out of five make are
> wrong?  Seems like a big area for cleanup.
I've read a bit and I think the best for a driver writer (i.e. the role
I have when changing drivers/spi/spi_imx.c) is to accept what
platform_get_irq returns to me.  If the platform specified 

	struct resource mydevicesresources[] = {
		...
		{
			.start = 0,
			.end = 0,
			.flags = IORESOURCE_IRQ,
		},
		...
	};

then the best thing to do is to take irq0, isn't it.  So as
platform_get_irq is implemented as

	int platform_get_irq(struct platform_device *dev, unsigned int num)
	{
	        struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);

        	return r ? r->start : -ENXIO;
	}

testing for <0 seems right to me.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ