]> err.no Git - linux-2.6/commitdiff
[PATCH] handle errors returned by platform_get_irq*()
authorDavid Vrabel <dvrabel@arcom.com>
Thu, 19 Jan 2006 17:56:29 +0000 (17:56 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Mar 2006 21:42:57 +0000 (13:42 -0800)
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>
19 files changed:
arch/arm/common/locomo.c
arch/arm/common/sa1111.c
drivers/char/s3c2410-rtc.c
drivers/char/watchdog/mpcore_wdt.c
drivers/i2c/busses/i2c-iop3xx.c
drivers/i2c/busses/i2c-mpc.c
drivers/i2c/busses/i2c-mv64xxx.c
drivers/ide/mips/au1xxx-ide.c
drivers/mmc/pxamci.c
drivers/net/arm/am79c961a.c
drivers/net/fs_enet/mac-fcc.c
drivers/net/fs_enet/mac-fec.c
drivers/net/fs_enet/mac-scc.c
drivers/net/gianfar.c
drivers/net/smc91x.c
drivers/pcmcia/omap_cf.c
drivers/serial/s3c2410.c
drivers/usb/host/ohci-omap.c
drivers/video/sa1100fb.c

index d31b1cb7eea0d83ed2cb632ed07b42d593aad3c7..23609400a8e2f2ca9a1253dce10ff20a1a391d1f 100644 (file)
@@ -788,6 +788,8 @@ static int locomo_probe(struct platform_device *dev)
        if (!mem)
                return -EINVAL;
        irq = platform_get_irq(dev, 0);
+       if (irq < 0)
+               return -ENXIO;
 
        return __locomo_probe(&dev->dev, mem, irq);
 }
index 1475089f9b4265f7b2c9dc86696dea0a4970c027..93352f6097c1b387d799b025653147994fbdbbda 100644 (file)
@@ -943,6 +943,8 @@ static int sa1111_probe(struct platform_device *pdev)
        if (!mem)
                return -EINVAL;
        irq = platform_get_irq(pdev, 0);
+       if (irq < 0)
+               return -ENXIO;
 
        return __sa1111_probe(&pdev->dev, mem, irq);
 }
index 2e308657f6f6df733acb3ea381d4604264e60e87..b0038b19b5056a7bbca2991b704749ed5d2a153a 100644 (file)
@@ -448,13 +448,13 @@ static int s3c2410_rtc_probe(struct platform_device *pdev)
        /* 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 b4d843489881adaacdf3e2326ed09bf49b9b0f7d..2c2c517732000a8337d2da0ee54383eb0ce1f0ed 100644 (file)
@@ -338,6 +338,10 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)
 
        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 1414851a17b8ee1ea13df7124060dec12522055b..d00a02fc23e42b3878390d58c2619eec0cf222bf 100644 (file)
@@ -434,7 +434,7 @@ static int
 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 @@ iop3xx_i2c_probe(struct platform_device *pdev)
                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 5ccd338a9dc98f19c273bcc81e3e758e0ab85594..2721e4c8184a9a64f505686ebf7bf6e1e80ecf59 100644 (file)
@@ -302,6 +302,10 @@ static int fsl_i2c_probe(struct platform_device *pdev)
        }
 
        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 @@ static int fsl_i2c_probe(struct platform_device *pdev)
       fail_irq:
        iounmap(i2c->base);
       fail_map:
+      fail_get_irq:
        kfree(i2c);
        return result;
 };
index 22781d84f79f256d0be11c412be15c1b6f2dc22d..ac5cde1bbd2ba24333d2360ce3b253d60a3426c8 100644 (file)
@@ -516,6 +516,10 @@ mv64xxx_i2c_probe(struct platform_device *pd)
        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 32431dcf5d8e51cf181ecd2f78b8cfa24fecc6c0..71f27e955d877d86d89bd63862b5206670f28061 100644 (file)
@@ -674,6 +674,11 @@ static int au_ide_probe(struct device *dev)
                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 285d7d0680977a6fbba99139a71a77fe7645d168..c32fad1ce51c88e0f75d9296d49ad17e47daae74 100644 (file)
@@ -438,7 +438,7 @@ static int pxamci_probe(struct platform_device *pdev)
 
        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 53e3afc1b7b7c865c850906d4601865fe33ae49d..09d5c3f26985a804e34b49e9ef6c6b0c84677b51 100644 (file)
@@ -696,7 +696,9 @@ static int __init am79c961_probe(struct platform_device *pdev)
        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 e67b1d06611cfb84bf44ce65bf35bba4852f63a9..95e2bb8dd7b415cacb3a770dc1dfc9e135e566d9 100644 (file)
@@ -118,6 +118,8 @@ static int do_pd_setup(struct fs_enet_private *fep)
 
        /* 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 2e8f444696999312562430600ecb55d4c0f096aa..3dad69dfdb2ccd90c407837906d085fdca42cbf2 100644 (file)
@@ -144,6 +144,8 @@ static int do_pd_setup(struct fs_enet_private *fep)
        
        /* 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 a3897fda71fa448c4f5d341e084da0ae87ad2569..a772b286f96d842e8c3391a6b50f10254e976d0b 100644 (file)
@@ -118,6 +118,8 @@ static int do_pd_setup(struct fs_enet_private *fep)
 
        /* 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 0e8e3fcde9ff9dc865a9c2170a5a4154aea52264..771e25d8c417440dd4c24dfee3f42bb326b532ef 100644 (file)
@@ -193,8 +193,12 @@ static int gfar_probe(struct platform_device *pdev)
                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 7ec08127c9d6c4f8594d805392155e3bddccd875..75e9b3b910cc31ba9d18ff8d4c5deb281c402d14 100644 (file)
@@ -2221,6 +2221,10 @@ static int smc_drv_probe(struct platform_device *pdev)
 
        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 47b5ade95bde5ae8093997c208f79ed242a4aaa7..2c23d758439982be6eb765667e586596a44dea08 100644 (file)
@@ -218,7 +218,7 @@ static int __init omap_cf_probe(struct device *dev)
 
        /* 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 7410e093a6b9ffa733a4629c947c4d7324ecdcc7..00d7c0ad8cbfee7057dd2fed82ac91db5c9c81da 100644 (file)
@@ -1066,6 +1066,8 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
        port->mapbase   = res->start;
        port->membase   = S3C24XX_VA_UART + (res->start - S3C24XX_PA_UART);
        port->irq       = platform_get_irq(platdev, 0);
+       if (port->irq < 0)
+               port->irq = 0;
 
        ourport->clk    = clk_get(&platdev->dev, "uart");
 
index 3785b3f7df1be4e1c2cb0d95769f21ce4c04720a..ca19abe01c5331437bfb9e25e9324f05686ab964 100644 (file)
@@ -286,7 +286,7 @@ void usb_hcd_omap_remove (struct usb_hcd *, struct platform_device *);
 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 @@ int usb_hcd_omap_probe (const struct hc_driver *driver,
        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 8a893ce7040de1feae90633d46c5800c95357ef1..d9831fd4234184c92a0a4468839eb2612cec5388 100644 (file)
@@ -1457,7 +1457,7 @@ static int __init sa1100fb_probe(struct platform_device *pdev)
        int ret, irq;
 
        irq = platform_get_irq(pdev, 0);
-       if (irq <= 0)
+       if (irq < 0)
                return -EINVAL;
 
        if (!request_mem_region(0xb0100000, 0x10000, "LCD"))