aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Vrabel <dvrabel@arcom.com>2006-01-19 12:56:29 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-20 16:42:57 -0500
commit489447380a2921ec0e9154f773c44ab3167ede4b (patch)
tree10edc2bca15765dae7699b8d26cf3d828869bc3c /drivers
parent305b3228f9ff4d59f49e6d34a7034d44ee8ce2f0 (diff)
[PATCH] handle errors returned by platform_get_irq*()
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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/s3c2410-rtc.c4
-rw-r--r--drivers/char/watchdog/mpcore_wdt.c4
-rw-r--r--drivers/i2c/busses/i2c-iop3xx.c9
-rw-r--r--drivers/i2c/busses/i2c-mpc.c5
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c4
-rw-r--r--drivers/ide/mips/au1xxx-ide.c5
-rw-r--r--drivers/mmc/pxamci.c2
-rw-r--r--drivers/net/arm/am79c961a.c4
-rw-r--r--drivers/net/fs_enet/mac-fcc.c2
-rw-r--r--drivers/net/fs_enet/mac-fec.c2
-rw-r--r--drivers/net/fs_enet/mac-scc.c2
-rw-r--r--drivers/net/gianfar.c4
-rw-r--r--drivers/net/smc91x.c4
-rw-r--r--drivers/pcmcia/omap_cf.c2
-rw-r--r--drivers/serial/s3c2410.c2
-rw-r--r--drivers/usb/host/ohci-omap.c9
-rw-r--r--drivers/video/sa1100fb.c2
17 files changed, 56 insertions, 10 deletions
diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c
index 2e308657f6f6..b0038b19b505 100644
--- a/drivers/char/s3c2410-rtc.c
+++ b/drivers/char/s3c2410-rtc.c
@@ -448,13 +448,13 @@ static int s3c2410_rtc_probe(struct platform_device *pdev)
448 /* find the IRQs */ 448 /* find the IRQs */
449 449
450 s3c2410_rtc_tickno = platform_get_irq(pdev, 1); 450 s3c2410_rtc_tickno = platform_get_irq(pdev, 1);
451 if (s3c2410_rtc_tickno <= 0) { 451 if (s3c2410_rtc_tickno < 0) {
452 dev_err(&pdev->dev, "no irq for rtc tick\n"); 452 dev_err(&pdev->dev, "no irq for rtc tick\n");
453 return -ENOENT; 453 return -ENOENT;
454 } 454 }
455 455
456 s3c2410_rtc_alarmno = platform_get_irq(pdev, 0); 456 s3c2410_rtc_alarmno = platform_get_irq(pdev, 0);
457 if (s3c2410_rtc_alarmno <= 0) { 457 if (s3c2410_rtc_alarmno < 0) {
458 dev_err(&pdev->dev, "no irq for alarm\n"); 458 dev_err(&pdev->dev, "no irq for alarm\n");
459 return -ENOENT; 459 return -ENOENT;
460 } 460 }
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/char/watchdog/mpcore_wdt.c
index b4d843489881..2c2c51773200 100644
--- a/drivers/char/watchdog/mpcore_wdt.c
+++ b/drivers/char/watchdog/mpcore_wdt.c
@@ -338,6 +338,10 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)
338 338
339 wdt->dev = &dev->dev; 339 wdt->dev = &dev->dev;
340 wdt->irq = platform_get_irq(dev, 0); 340 wdt->irq = platform_get_irq(dev, 0);
341 if (wdt->irq < 0) {
342 ret = -ENXIO;
343 goto err_free;
344 }
341 wdt->base = ioremap(res->start, res->end - res->start + 1); 345 wdt->base = ioremap(res->start, res->end - res->start + 1);
342 if (!wdt->base) { 346 if (!wdt->base) {
343 ret = -ENOMEM; 347 ret = -ENOMEM;
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index 1414851a17b8..d00a02fc23e4 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -434,7 +434,7 @@ static int
434iop3xx_i2c_probe(struct platform_device *pdev) 434iop3xx_i2c_probe(struct platform_device *pdev)
435{ 435{
436 struct resource *res; 436 struct resource *res;
437 int ret; 437 int ret, irq;
438 struct i2c_adapter *new_adapter; 438 struct i2c_adapter *new_adapter;
439 struct i2c_algo_iop3xx_data *adapter_data; 439 struct i2c_algo_iop3xx_data *adapter_data;
440 440
@@ -470,7 +470,12 @@ iop3xx_i2c_probe(struct platform_device *pdev)
470 goto release_region; 470 goto release_region;
471 } 471 }
472 472
473 ret = request_irq(platform_get_irq(pdev, 0), iop3xx_i2c_irq_handler, 0, 473 irq = platform_get_irq(pdev, 0);
474 if (irq < 0) {
475 ret = -ENXIO;
476 goto unmap;
477 }
478 ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
474 pdev->name, adapter_data); 479 pdev->name, adapter_data);
475 480
476 if (ret) { 481 if (ret) {
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 5ccd338a9dc9..2721e4c8184a 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -302,6 +302,10 @@ static int fsl_i2c_probe(struct platform_device *pdev)
302 } 302 }
303 303
304 i2c->irq = platform_get_irq(pdev, 0); 304 i2c->irq = platform_get_irq(pdev, 0);
305 if (i2c->irq < 0) {
306 result = -ENXIO;
307 goto fail_get_irq;
308 }
305 i2c->flags = pdata->device_flags; 309 i2c->flags = pdata->device_flags;
306 init_waitqueue_head(&i2c->queue); 310 init_waitqueue_head(&i2c->queue);
307 311
@@ -340,6 +344,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)
340 fail_irq: 344 fail_irq:
341 iounmap(i2c->base); 345 iounmap(i2c->base);
342 fail_map: 346 fail_map:
347 fail_get_irq:
343 kfree(i2c); 348 kfree(i2c);
344 return result; 349 return result;
345}; 350};
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 22781d84f79f..ac5cde1bbd2b 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -516,6 +516,10 @@ mv64xxx_i2c_probe(struct platform_device *pd)
516 drv_data->freq_m = pdata->freq_m; 516 drv_data->freq_m = pdata->freq_m;
517 drv_data->freq_n = pdata->freq_n; 517 drv_data->freq_n = pdata->freq_n;
518 drv_data->irq = platform_get_irq(pd, 0); 518 drv_data->irq = platform_get_irq(pd, 0);
519 if (drv_data->irq < 0) {
520 rc = -ENXIO;
521 goto exit_unmap_regs;
522 }
519 drv_data->adapter.id = I2C_HW_MV64XXX; 523 drv_data->adapter.id = I2C_HW_MV64XXX;
520 drv_data->adapter.algo = &mv64xxx_i2c_algo; 524 drv_data->adapter.algo = &mv64xxx_i2c_algo;
521 drv_data->adapter.owner = THIS_MODULE; 525 drv_data->adapter.owner = THIS_MODULE;
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 32431dcf5d8e..71f27e955d87 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -674,6 +674,11 @@ static int au_ide_probe(struct device *dev)
674 ret = -ENODEV; 674 ret = -ENODEV;
675 goto out; 675 goto out;
676 } 676 }
677 if (ahwif->irq < 0) {
678 pr_debug("%s %d: no IRQ\n", DRV_NAME, pdev->id);
679 ret = -ENODEV;
680 goto out;
681 }
677 682
678 if (!request_mem_region (res->start, res->end-res->start, pdev->name)) { 683 if (!request_mem_region (res->start, res->end-res->start, pdev->name)) {
679 pr_debug("%s: request_mem_region failed\n", DRV_NAME); 684 pr_debug("%s: request_mem_region failed\n", DRV_NAME);
diff --git a/drivers/mmc/pxamci.c b/drivers/mmc/pxamci.c
index 285d7d068097..c32fad1ce51c 100644
--- a/drivers/mmc/pxamci.c
+++ b/drivers/mmc/pxamci.c
@@ -438,7 +438,7 @@ static int pxamci_probe(struct platform_device *pdev)
438 438
439 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 439 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
440 irq = platform_get_irq(pdev, 0); 440 irq = platform_get_irq(pdev, 0);
441 if (!r || irq == NO_IRQ) 441 if (!r || irq < 0)
442 return -ENXIO; 442 return -ENXIO;
443 443
444 r = request_mem_region(r->start, SZ_4K, DRIVER_NAME); 444 r = request_mem_region(r->start, SZ_4K, DRIVER_NAME);
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
index 53e3afc1b7b7..09d5c3f26985 100644
--- a/drivers/net/arm/am79c961a.c
+++ b/drivers/net/arm/am79c961a.c
@@ -696,7 +696,9 @@ static int __init am79c961_probe(struct platform_device *pdev)
696 dev->base_addr = res->start; 696 dev->base_addr = res->start;
697 dev->irq = platform_get_irq(pdev, 0); 697 dev->irq = platform_get_irq(pdev, 0);
698 698
699 ret = -ENODEV; 699 ret = -ENODEV;
700 if (dev->irq < 0)
701 goto nodev;
700 if (!request_region(dev->base_addr, 0x18, dev->name)) 702 if (!request_region(dev->base_addr, 0x18, dev->name))
701 goto nodev; 703 goto nodev;
702 704
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c
index e67b1d06611c..95e2bb8dd7b4 100644
--- a/drivers/net/fs_enet/mac-fcc.c
+++ b/drivers/net/fs_enet/mac-fcc.c
@@ -118,6 +118,8 @@ static int do_pd_setup(struct fs_enet_private *fep)
118 118
119 /* Fill out IRQ field */ 119 /* Fill out IRQ field */
120 fep->interrupt = platform_get_irq(pdev, 0); 120 fep->interrupt = platform_get_irq(pdev, 0);
121 if (fep->interrupt < 0)
122 return -EINVAL;
121 123
122 /* Attach the memory for the FCC Parameter RAM */ 124 /* Attach the memory for the FCC Parameter RAM */
123 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram"); 125 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fcc_pram");
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index 2e8f44469699..3dad69dfdb2c 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -144,6 +144,8 @@ static int do_pd_setup(struct fs_enet_private *fep)
144 144
145 /* Fill out IRQ field */ 145 /* Fill out IRQ field */
146 fep->interrupt = platform_get_irq_byname(pdev,"interrupt"); 146 fep->interrupt = platform_get_irq_byname(pdev,"interrupt");
147 if (fep->interrupt < 0)
148 return -EINVAL;
147 149
148 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); 150 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
149 fep->fec.fecp =(void*)r->start; 151 fep->fec.fecp =(void*)r->start;
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index a3897fda71fa..a772b286f96d 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -118,6 +118,8 @@ static int do_pd_setup(struct fs_enet_private *fep)
118 118
119 /* Fill out IRQ field */ 119 /* Fill out IRQ field */
120 fep->interrupt = platform_get_irq_byname(pdev, "interrupt"); 120 fep->interrupt = platform_get_irq_byname(pdev, "interrupt");
121 if (fep->interrupt < 0)
122 return -EINVAL;
121 123
122 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); 124 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
123 fep->scc.sccp = (void *)r->start; 125 fep->scc.sccp = (void *)r->start;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 0e8e3fcde9ff..771e25d8c417 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -193,8 +193,12 @@ static int gfar_probe(struct platform_device *pdev)
193 priv->interruptTransmit = platform_get_irq_byname(pdev, "tx"); 193 priv->interruptTransmit = platform_get_irq_byname(pdev, "tx");
194 priv->interruptReceive = platform_get_irq_byname(pdev, "rx"); 194 priv->interruptReceive = platform_get_irq_byname(pdev, "rx");
195 priv->interruptError = platform_get_irq_byname(pdev, "error"); 195 priv->interruptError = platform_get_irq_byname(pdev, "error");
196 if (priv->interruptTransmit < 0 || priv->interruptReceive < 0 || priv->interruptError < 0)
197 goto regs_fail;
196 } else { 198 } else {
197 priv->interruptTransmit = platform_get_irq(pdev, 0); 199 priv->interruptTransmit = platform_get_irq(pdev, 0);
200 if (priv->interruptTransmit < 0)
201 goto regs_fail;
198 } 202 }
199 203
200 /* get a pointer to the register memory */ 204 /* get a pointer to the register memory */
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 7ec08127c9d6..75e9b3b910cc 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -2221,6 +2221,10 @@ static int smc_drv_probe(struct platform_device *pdev)
2221 2221
2222 ndev->dma = (unsigned char)-1; 2222 ndev->dma = (unsigned char)-1;
2223 ndev->irq = platform_get_irq(pdev, 0); 2223 ndev->irq = platform_get_irq(pdev, 0);
2224 if (ndev->irq < 0) {
2225 ret = -ENODEV;
2226 goto out_free_netdev;
2227 }
2224 2228
2225 ret = smc_request_attrib(pdev); 2229 ret = smc_request_attrib(pdev);
2226 if (ret) 2230 if (ret)
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c
index 47b5ade95bde..2c23d7584399 100644
--- a/drivers/pcmcia/omap_cf.c
+++ b/drivers/pcmcia/omap_cf.c
@@ -218,7 +218,7 @@ static int __init omap_cf_probe(struct device *dev)
218 218
219 /* either CFLASH.IREQ (INT_1610_CF) or some GPIO */ 219 /* either CFLASH.IREQ (INT_1610_CF) or some GPIO */
220 irq = platform_get_irq(pdev, 0); 220 irq = platform_get_irq(pdev, 0);
221 if (!irq) 221 if (irq < 0)
222 return -EINVAL; 222 return -EINVAL;
223 223
224 cf = kcalloc(1, sizeof *cf, GFP_KERNEL); 224 cf = kcalloc(1, sizeof *cf, GFP_KERNEL);
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 7410e093a6b9..00d7c0ad8cbf 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -1066,6 +1066,8 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
1066 port->mapbase = res->start; 1066 port->mapbase = res->start;
1067 port->membase = S3C24XX_VA_UART + (res->start - S3C24XX_PA_UART); 1067 port->membase = S3C24XX_VA_UART + (res->start - S3C24XX_PA_UART);
1068 port->irq = platform_get_irq(platdev, 0); 1068 port->irq = platform_get_irq(platdev, 0);
1069 if (port->irq < 0)
1070 port->irq = 0;
1069 1071
1070 ourport->clk = clk_get(&platdev->dev, "uart"); 1072 ourport->clk = clk_get(&platdev->dev, "uart");
1071 1073
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 3785b3f7df1b..ca19abe01c53 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -286,7 +286,7 @@ void usb_hcd_omap_remove (struct usb_hcd *, struct platform_device *);
286int usb_hcd_omap_probe (const struct hc_driver *driver, 286int usb_hcd_omap_probe (const struct hc_driver *driver,
287 struct platform_device *pdev) 287 struct platform_device *pdev)
288{ 288{
289 int retval; 289 int retval, irq;
290 struct usb_hcd *hcd = 0; 290 struct usb_hcd *hcd = 0;
291 struct ohci_hcd *ohci; 291 struct ohci_hcd *ohci;
292 292
@@ -329,7 +329,12 @@ int usb_hcd_omap_probe (const struct hc_driver *driver,
329 if (retval < 0) 329 if (retval < 0)
330 goto err2; 330 goto err2;
331 331
332 retval = usb_add_hcd(hcd, platform_get_irq(pdev, 0), SA_INTERRUPT); 332 irq = platform_get_irq(pdev, 0);
333 if (irq < 0) {
334 retval = -ENXIO;
335 goto err2;
336 }
337 retval = usb_add_hcd(hcd, irq, SA_INTERRUPT);
333 if (retval == 0) 338 if (retval == 0)
334 return retval; 339 return retval;
335 340
diff --git a/drivers/video/sa1100fb.c b/drivers/video/sa1100fb.c
index 8a893ce7040d..d9831fd42341 100644
--- a/drivers/video/sa1100fb.c
+++ b/drivers/video/sa1100fb.c
@@ -1457,7 +1457,7 @@ static int __init sa1100fb_probe(struct platform_device *pdev)
1457 int ret, irq; 1457 int ret, irq;
1458 1458
1459 irq = platform_get_irq(pdev, 0); 1459 irq = platform_get_irq(pdev, 0);
1460 if (irq <= 0) 1460 if (irq < 0)
1461 return -EINVAL; 1461 return -EINVAL;
1462 1462
1463 if (!request_mem_region(0xb0100000, 0x10000, "LCD")) 1463 if (!request_mem_region(0xb0100000, 0x10000, "LCD"))