linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [DRIVER CORE] platform_get_irq*(): return NO_IRQ on error
@ 2006-01-05 17:11 David Vrabel
  2006-01-05 17:26 ` Russell King
  2006-01-05 17:37 ` Greg KH
  0 siblings, 2 replies; 8+ messages in thread
From: David Vrabel @ 2006-01-05 17:11 UTC (permalink / raw)
  To: Linux Kernel; +Cc: gregkh, Russell King

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

platform_get_irq*() cannot return 0 on error as 0 is a valid IRQ on some
platforms, return NO_IRQ (-1) instead.

Signed-off-by: David Vrabel <dvrabel@arcom.com>
-- 
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web: http://www.arcom.com/

[-- Attachment #2: platform_get_irq-return-NO_IRQ --]
[-- Type: text/plain, Size: 622 bytes --]

Index: linux-2.6-working/drivers/base/platform.c
===================================================================
--- linux-2.6-working.orig/drivers/base/platform.c	2006-01-05 16:49:23.000000000 +0000
+++ linux-2.6-working/drivers/base/platform.c	2006-01-05 17:10:18.000000000 +0000
@@ -59,7 +59,7 @@
 {
 	struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
 
-	return r ? r->start : 0;
+	return r ? r->start : NO_IRQ;
 }
 
 /**
@@ -94,7 +94,7 @@
 {
 	struct resource *r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name);
 
-	return r ? r->start : 0;
+	return r ? r->start : NO_IRQ;
 }
 
 /**

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [DRIVER CORE] platform_get_irq*(): return NO_IRQ on error
  2006-01-05 17:11 [DRIVER CORE] platform_get_irq*(): return NO_IRQ on error David Vrabel
@ 2006-01-05 17:26 ` Russell King
  2006-01-05 17:37 ` Greg KH
  1 sibling, 0 replies; 8+ messages in thread
From: Russell King @ 2006-01-05 17:26 UTC (permalink / raw)
  To: David Vrabel; +Cc: Linux Kernel, gregkh

On Thu, Jan 05, 2006 at 05:11:42PM +0000, David Vrabel wrote:
> platform_get_irq*() cannot return 0 on error as 0 is a valid IRQ on some
> platforms, return NO_IRQ (-1) instead.

This change would require an audit of the users of these functions.
Could you check whether this is going to cause them any problems?

> Index: linux-2.6-working/drivers/base/platform.c
> ===================================================================
> --- linux-2.6-working.orig/drivers/base/platform.c	2006-01-05 16:49:23.000000000 +0000
> +++ linux-2.6-working/drivers/base/platform.c	2006-01-05 17:10:18.000000000 +0000
> @@ -59,7 +59,7 @@
>  {
>  	struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
>  
> -	return r ? r->start : 0;
> +	return r ? r->start : NO_IRQ;
>  }
>  
>  /**
> @@ -94,7 +94,7 @@
>  {
>  	struct resource *r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name);
>  
> -	return r ? r->start : 0;
> +	return r ? r->start : NO_IRQ;
>  }
>  
>  /**


-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [DRIVER CORE] platform_get_irq*(): return NO_IRQ on error
  2006-01-05 17:11 [DRIVER CORE] platform_get_irq*(): return NO_IRQ on error David Vrabel
  2006-01-05 17:26 ` Russell King
@ 2006-01-05 17:37 ` Greg KH
  2006-01-05 18:03   ` David Vrabel
  1 sibling, 1 reply; 8+ messages in thread
From: Greg KH @ 2006-01-05 17:37 UTC (permalink / raw)
  To: David Vrabel; +Cc: Linux Kernel, Russell King

On Thu, Jan 05, 2006 at 05:11:42PM +0000, David Vrabel wrote:
> platform_get_irq*() cannot return 0 on error as 0 is a valid IRQ on some
> platforms, return NO_IRQ (-1) instead.
> 
> Signed-off-by: David Vrabel <dvrabel@arcom.com>
> -- 
> David Vrabel, Design Engineer
> 
> Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
> Cambridge CB1 7EA, UK         Web: http://www.arcom.com/

> Index: linux-2.6-working/drivers/base/platform.c
> ===================================================================
> --- linux-2.6-working.orig/drivers/base/platform.c	2006-01-05 16:49:23.000000000 +0000
> +++ linux-2.6-working/drivers/base/platform.c	2006-01-05 17:10:18.000000000 +0000
> @@ -59,7 +59,7 @@
>  {
>  	struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
>  
> -	return r ? r->start : 0;
> +	return r ? r->start : NO_IRQ;

No, I think the whole NO_IRQ stuff has been given up on, see the lkml
archives for details.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [DRIVER CORE] platform_get_irq*(): return   NO_IRQ on error
  2006-01-05 17:37 ` Greg KH
@ 2006-01-05 18:03   ` David Vrabel
  2006-01-05 18:08     ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: David Vrabel @ 2006-01-05 18:03 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux Kernel, Russell King

Greg KH wrote:
> On Thu, Jan 05, 2006 at 05:11:42PM +0000, David Vrabel wrote:
> 
>>platform_get_irq*() cannot return 0 on error as 0 is a valid IRQ on some
>>platforms, return NO_IRQ (-1) instead.
>>
>>Signed-off-by: David Vrabel <dvrabel@arcom.com>
>>
>>--- linux-2.6-working.orig/drivers/base/platform.c	2006-01-05 16:49:23.000000000 +0000
>>+++ linux-2.6-working/drivers/base/platform.c	2006-01-05 17:10:18.000000000 +0000
>>@@ -59,7 +59,7 @@
>> {
>> 	struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
>> 
>>-	return r ? r->start : 0;
>>+	return r ? r->start : NO_IRQ;
> 
> 
> No, I think the whole NO_IRQ stuff has been given up on, see the lkml
> archives for details.

Now that you mention it I remember that thread[1].

How about returning -ENXIO (or similar) then?

I went through all the users of platform_get_irq*() and some of them
assume < 0 is an error, some of them think 0 is an error, some of them
think 0 means there's no IRQ available, some of them use NO_IRQ, and
some don't even check and just pass the result to request_irq().

[1] http://lkml.org/lkml/2005/11/21/200
-- 
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web: http://www.arcom.com/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [DRIVER CORE] platform_get_irq*(): return   NO_IRQ on error
  2006-01-05 18:03   ` David Vrabel
@ 2006-01-05 18:08     ` Greg KH
  2006-01-19 17:49       ` [patch 0/2] driver core: platform_get_irq*(): return -ENXIO " David Vrabel
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2006-01-05 18:08 UTC (permalink / raw)
  To: David Vrabel; +Cc: Linux Kernel, Russell King

On Thu, Jan 05, 2006 at 06:03:10PM +0000, David Vrabel wrote:
> Greg KH wrote:
> > On Thu, Jan 05, 2006 at 05:11:42PM +0000, David Vrabel wrote:
> > 
> >>platform_get_irq*() cannot return 0 on error as 0 is a valid IRQ on some
> >>platforms, return NO_IRQ (-1) instead.
> >>
> >>Signed-off-by: David Vrabel <dvrabel@arcom.com>
> >>
> >>--- linux-2.6-working.orig/drivers/base/platform.c	2006-01-05 16:49:23.000000000 +0000
> >>+++ linux-2.6-working/drivers/base/platform.c	2006-01-05 17:10:18.000000000 +0000
> >>@@ -59,7 +59,7 @@
> >> {
> >> 	struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
> >> 
> >>-	return r ? r->start : 0;
> >>+	return r ? r->start : NO_IRQ;
> > 
> > 
> > No, I think the whole NO_IRQ stuff has been given up on, see the lkml
> > archives for details.
> 
> Now that you mention it I remember that thread[1].
> 
> How about returning -ENXIO (or similar) then?

That would be fine as long as you fix up all callers to not pass that
value to request_irq() :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch 0/2] driver core: platform_get_irq*(): return -ENXIO on error
  2006-01-05 18:08     ` Greg KH
@ 2006-01-19 17:49       ` David Vrabel
  2006-01-19 17:52         ` [patch 1/2] " David Vrabel
  2006-01-19 17:56         ` [patch 2/2] handle errors returned by platform_get_irq*() David Vrabel
  0 siblings, 2 replies; 8+ messages in thread
From: David Vrabel @ 2006-01-19 17:49 UTC (permalink / raw)
  To: Greg KH; +Cc: David Vrabel, Linux Kernel

platform_get_irq*() can't return 0 on error since 0 may be a valid IRQ.,
instead return a -ve error code.

platform_get_irq-return-error:
  - return -ENXIO if platform_get_irq*() can't find the resource.

platform_get_irq-fix-users-on-error:
  - fix all the users of platform_get_irq*() so they do something
sensible when it returns an error.

David Vrabel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch 1/2] driver core: platform_get_irq*(): return -ENXIO on error
  2006-01-19 17:49       ` [patch 0/2] driver core: platform_get_irq*(): return -ENXIO " David Vrabel
@ 2006-01-19 17:52         ` David Vrabel
  2006-01-19 17:56         ` [patch 2/2] handle errors returned by platform_get_irq*() David Vrabel
  1 sibling, 0 replies; 8+ messages in thread
From: David Vrabel @ 2006-01-19 17:52 UTC (permalink / raw)
  To: Greg KH; +Cc: David Vrabel, Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

platform_get_irq*() cannot return 0 on error as 0 is a valid IRQ on some
platforms, return -ENXIO instead.

Signed-off-by: David Vrabel <dvrabel@arcom.com>
-- 
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web: http://www.arcom.com/

[-- Attachment #2: platform_get_irq-return-error --]
[-- Type: text/plain, Size: 622 bytes --]

Index: linux-2.6-working/drivers/base/platform.c
===================================================================
--- linux-2.6-working.orig/drivers/base/platform.c	2006-01-05 16:49:23.000000000 +0000
+++ linux-2.6-working/drivers/base/platform.c	2006-01-05 17:10:18.000000000 +0000
@@ -59,7 +59,7 @@
 {
 	struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
 
-	return r ? r->start : 0;
+	return r ? r->start : -ENXIO;
 }
 
 /**
@@ -94,7 +94,7 @@
 {
 	struct resource *r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name);
 
-	return r ? r->start : 0;
+	return r ? r->start : -ENXIO;
 }
 
 /**

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [patch 2/2] handle errors returned by platform_get_irq*()
  2006-01-19 17:49       ` [patch 0/2] driver core: platform_get_irq*(): return -ENXIO " David Vrabel
  2006-01-19 17:52         ` [patch 1/2] " David Vrabel
@ 2006-01-19 17:56         ` David Vrabel
  1 sibling, 0 replies; 8+ messages in thread
From: David Vrabel @ 2006-01-19 17:56 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

platform_get_irq*() now returns on -ENXIO when the resource cannot be
found.  Ensure all users of platform_get_irq*() handle this error
appropriately.

Signed-off-by: David Vrabel <dvrabel@arcom.com>
-- 
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web: http://www.arcom.com/

[-- Attachment #2: platform_get_irq-fix-users-on-error --]
[-- Type: text/plain, Size: 11262 bytes --]

Index: linux-2.6-working/arch/arm/common/locomo.c
===================================================================
--- linux-2.6-working.orig/arch/arm/common/locomo.c	2006-01-18 11:05:44.000000000 +0000
+++ linux-2.6-working/arch/arm/common/locomo.c	2006-01-19 15:07:05.000000000 +0000
@@ -767,6 +767,8 @@
 	if (!mem)
 		return -EINVAL;
 	irq = platform_get_irq(dev, 0);
+	if (irq < 0)
+		return -ENXIO;
 
 	return __locomo_probe(&dev->dev, mem, irq);
 }
Index: linux-2.6-working/arch/arm/common/sa1111.c
===================================================================
--- linux-2.6-working.orig/arch/arm/common/sa1111.c	2006-01-18 11:05:44.000000000 +0000
+++ linux-2.6-working/arch/arm/common/sa1111.c	2006-01-19 15:07:32.000000000 +0000
@@ -943,6 +943,8 @@
 	if (!mem)
 		return -EINVAL;
 	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return -ENXIO;
 
 	return __sa1111_probe(&pdev->dev, mem, irq);
 }
Index: linux-2.6-working/drivers/char/s3c2410-rtc.c
===================================================================
--- linux-2.6-working.orig/drivers/char/s3c2410-rtc.c	2006-01-18 11:06:11.000000000 +0000
+++ linux-2.6-working/drivers/char/s3c2410-rtc.c	2006-01-19 14:54:26.000000000 +0000
@@ -448,13 +448,13 @@
 	/* find the IRQs */
 
 	s3c2410_rtc_tickno = platform_get_irq(pdev, 1);
-	if (s3c2410_rtc_tickno <= 0) {
+	if (s3c2410_rtc_tickno < 0) {
 		dev_err(&pdev->dev, "no irq for rtc tick\n");
 		return -ENOENT;
 	}
 
 	s3c2410_rtc_alarmno = platform_get_irq(pdev, 0);
-	if (s3c2410_rtc_alarmno <= 0) {
+	if (s3c2410_rtc_alarmno < 0) {
 		dev_err(&pdev->dev, "no irq for alarm\n");
 		return -ENOENT;
 	}
Index: linux-2.6-working/drivers/char/watchdog/mpcore_wdt.c
===================================================================
--- linux-2.6-working.orig/drivers/char/watchdog/mpcore_wdt.c	2006-01-03 08:46:52.000000000 +0000
+++ linux-2.6-working/drivers/char/watchdog/mpcore_wdt.c	2006-01-19 14:53:58.000000000 +0000
@@ -338,6 +338,10 @@
 
 	wdt->dev = &dev->dev;
 	wdt->irq = platform_get_irq(dev, 0);
+	if (wdt->irq < 0) {
+		ret = -ENXIO;
+		goto err_free;
+	}
 	wdt->base = ioremap(res->start, res->end - res->start + 1);
 	if (!wdt->base) {
 		ret = -ENOMEM;
Index: linux-2.6-working/drivers/i2c/busses/i2c-iop3xx.c
===================================================================
--- linux-2.6-working.orig/drivers/i2c/busses/i2c-iop3xx.c	2006-01-03 08:46:53.000000000 +0000
+++ linux-2.6-working/drivers/i2c/busses/i2c-iop3xx.c	2006-01-19 14:51:54.000000000 +0000
@@ -434,7 +434,7 @@
 iop3xx_i2c_probe(struct platform_device *pdev)
 {
 	struct resource *res;
-	int ret;
+	int ret, irq;
 	struct i2c_adapter *new_adapter;
 	struct i2c_algo_iop3xx_data *adapter_data;
 
@@ -470,7 +470,12 @@
 		goto release_region;
 	}
 
-	ret = request_irq(platform_get_irq(pdev, 0), iop3xx_i2c_irq_handler, 0,
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		ret = -ENXIO;
+		goto unmap;
+	}
+	ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
 				pdev->name, adapter_data);
 
 	if (ret) {
Index: linux-2.6-working/drivers/i2c/busses/i2c-mpc.c
===================================================================
--- linux-2.6-working.orig/drivers/i2c/busses/i2c-mpc.c	2006-01-03 08:46:53.000000000 +0000
+++ linux-2.6-working/drivers/i2c/busses/i2c-mpc.c	2006-01-19 14:50:17.000000000 +0000
@@ -302,6 +302,10 @@
 	}
 
 	i2c->irq = platform_get_irq(pdev, 0);
+	if (i2c->irq < 0) {
+		result = -ENXIO;
+		goto fail_get_irq;
+	}
 	i2c->flags = pdata->device_flags;
 	init_waitqueue_head(&i2c->queue);
 
@@ -340,6 +344,7 @@
       fail_irq:
 	iounmap(i2c->base);
       fail_map:
+      fail_get_irq:
 	kfree(i2c);
 	return result;
 };
Index: linux-2.6-working/drivers/i2c/busses/i2c-mv64xxx.c
===================================================================
--- linux-2.6-working.orig/drivers/i2c/busses/i2c-mv64xxx.c	2006-01-18 11:06:12.000000000 +0000
+++ linux-2.6-working/drivers/i2c/busses/i2c-mv64xxx.c	2006-01-19 14:53:06.000000000 +0000
@@ -516,6 +516,10 @@
 	drv_data->freq_m = pdata->freq_m;
 	drv_data->freq_n = pdata->freq_n;
 	drv_data->irq = platform_get_irq(pd, 0);
+	if (drv_data->irq < 0) {
+		rc = -ENXIO;
+		goto exit_unmap_regs;
+	}
 	drv_data->adapter.id = I2C_HW_MV64XXX;
 	drv_data->adapter.algo = &mv64xxx_i2c_algo;
 	drv_data->adapter.owner = THIS_MODULE;
Index: linux-2.6-working/drivers/ide/mips/au1xxx-ide.c
===================================================================
--- linux-2.6-working.orig/drivers/ide/mips/au1xxx-ide.c	2006-01-03 08:46:53.000000000 +0000
+++ linux-2.6-working/drivers/ide/mips/au1xxx-ide.c	2006-01-19 15:04:45.000000000 +0000
@@ -674,6 +674,11 @@
 		ret = -ENODEV;
 		goto out;
 	}
+	if (ahwif->irq < 0) {
+		pr_debug("%s %d: no IRQ\n", DRV_NAME, pdev->id);
+		ret = -ENODEV;
+		goto out;
+	}
 
 	if (!request_mem_region (res->start, res->end-res->start, pdev->name)) {
 		pr_debug("%s: request_mem_region failed\n", DRV_NAME);
Index: linux-2.6-working/drivers/mmc/pxamci.c
===================================================================
--- linux-2.6-working.orig/drivers/mmc/pxamci.c	2006-01-03 08:46:53.000000000 +0000
+++ linux-2.6-working/drivers/mmc/pxamci.c	2006-01-19 15:05:29.000000000 +0000
@@ -437,7 +437,7 @@
 
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(pdev, 0);
-	if (!r || irq == NO_IRQ)
+	if (!r || irq < 0)
 		return -ENXIO;
 
 	r = request_mem_region(r->start, SZ_4K, DRIVER_NAME);
Index: linux-2.6-working/drivers/net/arm/am79c961a.c
===================================================================
--- linux-2.6-working.orig/drivers/net/arm/am79c961a.c	2006-01-18 11:06:20.000000000 +0000
+++ linux-2.6-working/drivers/net/arm/am79c961a.c	2006-01-19 14:38:59.000000000 +0000
@@ -696,7 +696,9 @@
 	dev->base_addr = res->start;
 	dev->irq = platform_get_irq(pdev, 0);
 
-    	ret = -ENODEV;
+	ret = -ENODEV;
+	if (dev->irq < 0)
+		goto nodev;
 	if (!request_region(dev->base_addr, 0x18, dev->name))
 		goto nodev;
 
Index: linux-2.6-working/drivers/net/fs_enet/mac-fcc.c
===================================================================
--- linux-2.6-working.orig/drivers/net/fs_enet/mac-fcc.c	2006-01-03 08:46:53.000000000 +0000
+++ linux-2.6-working/drivers/net/fs_enet/mac-fcc.c	2006-01-19 14:45:36.000000000 +0000
@@ -118,6 +118,8 @@
 
 	/* Fill out IRQ field */
 	fep->interrupt = platform_get_irq(pdev, 0);
+	if (fep->interrupt < 0)
+		return -EINVAL;
 
 	/* Attach the memory for the FCC Parameter RAM */
 	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram");
Index: linux-2.6-working/drivers/net/fs_enet/mac-fec.c
===================================================================
--- linux-2.6-working.orig/drivers/net/fs_enet/mac-fec.c	2006-01-03 08:46:53.000000000 +0000
+++ linux-2.6-working/drivers/net/fs_enet/mac-fec.c	2006-01-19 14:46:30.000000000 +0000
@@ -144,6 +144,8 @@
 	
 	/* Fill out IRQ field */
 	fep->interrupt = platform_get_irq_byname(pdev,"interrupt");
+	if (fep->interrupt < 0)
+		return -EINVAL;
 	
 	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
 	fep->fec.fecp =(void*)r->start;
Index: linux-2.6-working/drivers/net/fs_enet/mac-scc.c
===================================================================
--- linux-2.6-working.orig/drivers/net/fs_enet/mac-scc.c	2006-01-03 08:46:53.000000000 +0000
+++ linux-2.6-working/drivers/net/fs_enet/mac-scc.c	2006-01-19 14:47:21.000000000 +0000
@@ -118,6 +118,8 @@
 
 	/* Fill out IRQ field */
 	fep->interrupt = platform_get_irq_byname(pdev, "interrupt");
+	if (fep->interrupt < 0)
+		return -EINVAL;
 
 	r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
 	fep->scc.sccp = (void *)r->start;
Index: linux-2.6-working/drivers/net/gianfar.c
===================================================================
--- linux-2.6-working.orig/drivers/net/gianfar.c	2006-01-18 11:06:20.000000000 +0000
+++ linux-2.6-working/drivers/net/gianfar.c	2006-01-19 14:42:07.000000000 +0000
@@ -193,8 +193,12 @@
 		priv->interruptTransmit = platform_get_irq_byname(pdev, "tx");
 		priv->interruptReceive = platform_get_irq_byname(pdev, "rx");
 		priv->interruptError = platform_get_irq_byname(pdev, "error");
+		if (priv->interruptTransmit < 0 || priv->interruptReceive < 0 || priv->interruptError < 0)
+			goto regs_fail;
 	} else {
 		priv->interruptTransmit = platform_get_irq(pdev, 0);
+		if (priv->interruptTransmit < 0)
+			goto regs_fail;
 	}
 
 	/* get a pointer to the register memory */
Index: linux-2.6-working/drivers/net/smc91x.c
===================================================================
--- linux-2.6-working.orig/drivers/net/smc91x.c	2006-01-18 17:44:53.000000000 +0000
+++ linux-2.6-working/drivers/net/smc91x.c	2006-01-19 14:44:15.000000000 +0000
@@ -2221,6 +2221,10 @@
 
 	ndev->dma = (unsigned char)-1;
 	ndev->irq = platform_get_irq(pdev, 0);
+	if (ndev->irq < 0) {
+		ret = -ENODEV;
+		goto out_free_netdev;
+	}
 
 	ret = smc_request_attrib(pdev);
 	if (ret)
Index: linux-2.6-working/drivers/pcmcia/omap_cf.c
===================================================================
--- linux-2.6-working.orig/drivers/pcmcia/omap_cf.c	2006-01-03 08:46:53.000000000 +0000
+++ linux-2.6-working/drivers/pcmcia/omap_cf.c	2006-01-19 15:05:04.000000000 +0000
@@ -218,7 +218,7 @@
 
 	/* either CFLASH.IREQ (INT_1610_CF) or some GPIO */
 	irq = platform_get_irq(pdev, 0);
-	if (!irq)
+	if (irq < 0)
 		return -EINVAL;
 
 	cf = kcalloc(1, sizeof *cf, GFP_KERNEL);
Index: linux-2.6-working/drivers/serial/s3c2410.c
===================================================================
--- linux-2.6-working.orig/drivers/serial/s3c2410.c	2006-01-18 11:06:29.000000000 +0000
+++ linux-2.6-working/drivers/serial/s3c2410.c	2006-01-19 14:56:15.000000000 +0000
@@ -1062,6 +1062,8 @@
 	port->mapbase	= res->start;
 	port->membase	= S3C24XX_VA_UART + (res->start - S3C2410_PA_UART);
 	port->irq	= platform_get_irq(platdev, 0);
+	if (port->irq < 0)
+		port->irq = 0;
 
 	ourport->clk	= clk_get(&platdev->dev, "uart");
 
Index: linux-2.6-working/drivers/usb/host/ohci-omap.c
===================================================================
--- linux-2.6-working.orig/drivers/usb/host/ohci-omap.c	2006-01-18 11:06:31.000000000 +0000
+++ linux-2.6-working/drivers/usb/host/ohci-omap.c	2006-01-19 15:03:03.000000000 +0000
@@ -286,7 +286,7 @@
 int usb_hcd_omap_probe (const struct hc_driver *driver,
 			  struct platform_device *pdev)
 {
-	int retval;
+	int retval, irq;
 	struct usb_hcd *hcd = 0;
 	struct ohci_hcd *ohci;
 
@@ -329,7 +329,12 @@
 	if (retval < 0)
 		goto err2;
 
-	retval = usb_add_hcd(hcd, platform_get_irq(pdev, 0), SA_INTERRUPT);
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		retval = -ENXIO;
+		goto err2;
+	}
+	retval = usb_add_hcd(hcd, irq, SA_INTERRUPT);
 	if (retval == 0)
 		return retval;
 
Index: linux-2.6-working/drivers/video/sa1100fb.c
===================================================================
--- linux-2.6-working.orig/drivers/video/sa1100fb.c	2006-01-18 11:06:35.000000000 +0000
+++ linux-2.6-working/drivers/video/sa1100fb.c	2006-01-19 13:37:12.000000000 +0000
@@ -1457,7 +1457,7 @@
 	int ret, irq;
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq <= 0)
+	if (irq < 0)
 		return -EINVAL;
 
 	if (!request_mem_region(0xb0100000, 0x10000, "LCD"))

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-01-19 17:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-05 17:11 [DRIVER CORE] platform_get_irq*(): return NO_IRQ on error David Vrabel
2006-01-05 17:26 ` Russell King
2006-01-05 17:37 ` Greg KH
2006-01-05 18:03   ` David Vrabel
2006-01-05 18:08     ` Greg KH
2006-01-19 17:49       ` [patch 0/2] driver core: platform_get_irq*(): return -ENXIO " David Vrabel
2006-01-19 17:52         ` [patch 1/2] " David Vrabel
2006-01-19 17:56         ` [patch 2/2] handle errors returned by platform_get_irq*() David Vrabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).