]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
Xilinx: ARM: SWDT: fixed driver crash when interrupt not specified.
authorBryce Kellogg <bryce.kellogg@xilinx.com>
Mon, 30 Jul 2012 22:28:39 +0000 (15:28 -0700)
committerJohn Linn <john.linn@xilinx.com>
Tue, 31 Jul 2012 00:30:48 +0000 (17:30 -0700)
Previously the driver was not checking if the optional interrupt
parameters were in the devicetree and was trying to register
an interrupt handler no matter what. The driver has been changed
to only register an interrupt handler if the interrupt information
is present.

Signed-off-by: Bryce Kellogg <bryce.kellogg@xilinx.com>
drivers/watchdog/xilinx_wdtps.c

index 079004d217c3fe6a22159b4926891ad3e8a91998..360941217de429cb79569faa4cd9ddcc767129d7 100644 (file)
@@ -324,8 +324,8 @@ static int __init xwdtps_probe(struct platform_device *pdev)
        /* Register the interrupt */
        prop = of_get_property(pdev->dev.of_node, "reset", NULL);
        wdt->rst = prop ? be32_to_cpup(prop) : 0;
-       if (!wdt->rst) {
-               irq = platform_get_irq(pdev, 0);
+       irq = platform_get_irq(pdev, 0);
+       if (!wdt->rst && irq >= 0) {
                res = request_irq(irq, xwdtps_irq_handler, 0, pdev->name, pdev);
                if (res != 0) {
                        dev_err(&pdev->dev, "cannot register interrupt handler err=%d\n",