Subject: [PATCH] pata_of_platform: fix no irq handling

From: Anton Vorontsov <[email-masked]>
Date: Mon, 29 Sep 2008 17:32:36 +0400

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 <[email-masked]>
Signed-off-by: Anton Vorontsov <[email-masked]>
---

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 <[email-masked]> 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/[email-masked]/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