All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Li Yang <leoli@freescale.com>, Wang Jian <lark@linux.net.cn>,
	"Steven A. Falco" <sfalco@harris.com>,
	linuxppc-dev@ozlabs.org, linux-ide@vger.kernel.org
Subject: [PATCH] pata_of_platform: fix no irq handling
Date: Mon, 29 Sep 2008 17:32:36 +0400	[thread overview]
Message-ID: <20080929133236.GA19675@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <48E05742.1030609@pobox.com>

When no irq specified the pata_of_platform fills the irq_res with -1,
which is wrong to do for two reasons:

1. By definition, 'no irq' should be IRQ 0, not some negative integer;
2. pata_platform checks for irq_res.start > 0, but since irq_res.start
   is unsigned type, the check will be true for `-1'.

Reported-by: Steven A. Falco <sfalco@harris.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---

On Mon, Sep 29, 2008 at 12:19:14AM -0400, Jeff Garzik wrote:
> Anton Vorontsov wrote:
>> On Thu, Sep 25, 2008 at 06:40:59PM +0800, Li Yang wrote:
>>> On Thu, Sep 25, 2008 at 4:54 PM, Wang Jian <lark@linux.net.cn> wrote:
>>>> The alternative fix can be.
>>> This one is better as 0 is defined as 'invalid irq' for all
>>> architectures.  Added linux-ide and Anton to cc.
>>
>> Thanks for the correct Cc.
>>
>> I've sent a patch to fix the issue more than a month ago.
>>
>> http://www.mail-archive.com/linuxppc-dev@ozlabs.org/msg22851.html
>>
>> Jeff, could you apply the patch?
>
> Can you resend, I don't seem to have it...

Here it is.

Thanks,

 drivers/ata/pata_of_platform.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
index 408da30..1f18ad9 100644
--- a/drivers/ata/pata_of_platform.c
+++ b/drivers/ata/pata_of_platform.c
@@ -52,7 +52,7 @@ static int __devinit pata_of_platform_probe(struct of_device *ofdev,
 
 	ret = of_irq_to_resource(dn, 0, &irq_res);
 	if (ret == NO_IRQ)
-		irq_res.start = irq_res.end = -1;
+		irq_res.start = irq_res.end = 0;
 	else
 		irq_res.flags = 0;
 
-- 
1.5.6.3


WARNING: multiple messages have this Message-ID (diff)
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-ide@vger.kernel.org, linuxppc-dev@ozlabs.org,
	Li Yang <leoli@freescale.com>, Wang Jian <lark@linux.net.cn>
Subject: [PATCH] pata_of_platform: fix no irq handling
Date: Mon, 29 Sep 2008 17:32:36 +0400	[thread overview]
Message-ID: <20080929133236.GA19675@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <48E05742.1030609@pobox.com>

When no irq specified the pata_of_platform fills the irq_res with -1,
which is wrong to do for two reasons:

1. By definition, 'no irq' should be IRQ 0, not some negative integer;
2. pata_platform checks for irq_res.start > 0, but since irq_res.start
   is unsigned type, the check will be true for `-1'.

Reported-by: Steven A. Falco <sfalco@harris.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---

On Mon, Sep 29, 2008 at 12:19:14AM -0400, Jeff Garzik wrote:
> Anton Vorontsov wrote:
>> On Thu, Sep 25, 2008 at 06:40:59PM +0800, Li Yang wrote:
>>> On Thu, Sep 25, 2008 at 4:54 PM, Wang Jian <lark@linux.net.cn> wrote:
>>>> The alternative fix can be.
>>> This one is better as 0 is defined as 'invalid irq' for all
>>> architectures.  Added linux-ide and Anton to cc.
>>
>> Thanks for the correct Cc.
>>
>> I've sent a patch to fix the issue more than a month ago.
>>
>> http://www.mail-archive.com/linuxppc-dev@ozlabs.org/msg22851.html
>>
>> Jeff, could you apply the patch?
>
> Can you resend, I don't seem to have it...

Here it is.

Thanks,

 drivers/ata/pata_of_platform.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c
index 408da30..1f18ad9 100644
--- a/drivers/ata/pata_of_platform.c
+++ b/drivers/ata/pata_of_platform.c
@@ -52,7 +52,7 @@ static int __devinit pata_of_platform_probe(struct of_device *ofdev,
 
 	ret = of_irq_to_resource(dn, 0, &irq_res);
 	if (ret == NO_IRQ)
-		irq_res.start = irq_res.end = -1;
+		irq_res.start = irq_res.end = 0;
 	else
 		irq_res.flags = 0;
 
-- 
1.5.6.3

  reply	other threads:[~2008-09-29 13:32 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-25  8:36 [PATCH] pata_platform struct resource signness fix Wang Jian
2008-09-25  8:54 ` Wang Jian
2008-09-25 10:40   ` Li Yang
2008-09-25 10:40     ` Li Yang
2008-09-25 10:48     ` Anton Vorontsov
2008-09-25 10:48       ` Anton Vorontsov
2008-09-29  4:19       ` Jeff Garzik
2008-09-29  4:19         ` Jeff Garzik
2008-09-29 13:32         ` Anton Vorontsov [this message]
2008-09-29 13:32           ` [PATCH] pata_of_platform: fix no irq handling Anton Vorontsov
2008-09-25 15:33     ` [PATCH] pata_platform struct resource signness fix Wang Jian
2008-09-25 15:47       ` Anton Vorontsov
2008-09-25 15:47         ` Anton Vorontsov
2008-09-25  9:12 ` Leo Li
2008-09-25  9:30   ` Wang Jian
  -- strict thread matches above, loose matches on Subject: below --
2008-10-06 17:26 [PATCH] pata_of_platform: fix no irq handling Anton Vorontsov
2008-10-06 17:26 ` Anton Vorontsov
2008-10-06 20:41 ` Matt Sealey
2008-10-06 20:41   ` Matt Sealey
2008-10-06 21:32   ` Anton Vorontsov
2008-10-06 21:32     ` Anton Vorontsov
2008-10-07  1:30     ` Tejun Heo
2008-10-07  1:30       ` Tejun Heo
2008-10-07  9:18       ` Wang Jian
2008-10-07  9:18         ` Wang Jian
2008-10-07  9:26       ` Anton Vorontsov
2008-10-07  9:26         ` Anton Vorontsov
2008-10-07 10:04         ` Benjamin Herrenschmidt
2008-10-07 10:04           ` Benjamin Herrenschmidt
2008-10-07  9:37       ` Alan Cox
2008-10-07  9:37         ` Alan Cox
2008-10-08  8:40         ` David Woodhouse
2008-10-08  8:40           ` David Woodhouse
2008-10-08  9:00           ` Alan Cox
2008-10-08  9:00             ` Alan Cox
2008-10-08  9:59             ` Geert Uytterhoeven
2008-10-08  9:59               ` Geert Uytterhoeven
2008-10-08 10:27               ` Alan Cox
2008-10-08 10:27                 ` Alan Cox
2008-10-10 17:55               ` Paul Mundt
2008-10-10 17:55                 ` Paul Mundt
2008-10-13  6:56 ` Tejun Heo
2008-10-13  6:56   ` Tejun Heo
2008-10-13 13:27   ` Jeff Garzik
2008-10-13 13:53     ` Tejun Heo
2008-10-13 23:27   ` Benjamin Herrenschmidt
2008-10-13 23:27     ` Benjamin Herrenschmidt
2008-08-11 14:48 Possible bug in IRQ handling in pata_of_platform / pata_platform Steven A. Falco
2008-08-11 15:19 ` [PATCH] pata_of_platform: fix no irq handling Anton Vorontsov
2008-08-11 16:23   ` Steven A. Falco
2008-08-11 16:23     ` Steven A. Falco
2008-08-11 17:07     ` Anton Vorontsov
2008-08-11 17:07       ` Anton Vorontsov
2008-08-11 22:00       ` Benjamin Herrenschmidt
2008-08-12 14:00         ` Steven A. Falco
2008-08-12 14:00           ` Steven A. Falco
2008-08-12 14:04           ` Anton Vorontsov
2008-08-12 14:04             ` Anton Vorontsov
2008-08-12 14:18             ` Stefan Roese
2008-08-12 14:18               ` Stefan Roese
2008-08-12 14:18             ` Sergei Shtylyov
2008-08-12 14:18               ` Sergei Shtylyov
2008-08-12 14:31               ` Anton Vorontsov
2008-08-12 14:31                 ` Anton Vorontsov
2008-08-13 21:25                 ` Steven A. Falco
2008-08-13 21:25                   ` Steven A. Falco
2008-08-11 16:29   ` Alan Cox
2008-08-11 16:36   ` Ben Dooks
2008-08-11 16:36     ` Ben Dooks
2008-08-11 16:26     ` Alan Cox
2008-08-11 16:42     ` Steven A. Falco
2008-08-11 16:42       ` Steven A. Falco
2008-08-11 22:02     ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080929133236.GA19675@oksana.dev.rtsoft.ru \
    --to=avorontsov@ru.mvista.com \
    --cc=jgarzik@pobox.com \
    --cc=lark@linux.net.cn \
    --cc=leoli@freescale.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=sfalco@harris.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.