iio: adc: xilinx: Move request_irq before enabling interrupts
authorManish Narani <manish.narani@xilinx.com>
Mon, 23 Jul 2018 15:02:03 +0000 (20:32 +0530)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 29 Jul 2018 12:30:35 +0000 (13:30 +0100)
Enabling the Interrupts before registering the irq handler is a bad
idea. This patch corrects the same for XADC driver.

Signed-off-by: Manish Narani <manish.narani@xilinx.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/xilinx-xadc-core.c

index 44a25198387d26ba5ae1158f906d574f76a88e51..3f6be5ac049a864fcf792530afce1b909cc05f66 100644 (file)
@@ -1226,15 +1226,15 @@ static int xadc_probe(struct platform_device *pdev)
        if (ret)
                goto err_free_samplerate_trigger;
 
-       ret = xadc->ops->setup(pdev, indio_dev, xadc->irq);
-       if (ret)
-               goto err_clk_disable_unprepare;
-
        ret = request_irq(xadc->irq, xadc->ops->interrupt_handler, 0,
                        dev_name(&pdev->dev), indio_dev);
        if (ret)
                goto err_clk_disable_unprepare;
 
+       ret = xadc->ops->setup(pdev, indio_dev, xadc->irq);
+       if (ret)
+               goto err_free_irq;
+
        for (i = 0; i < 16; i++)
                xadc_read_adc_reg(xadc, XADC_REG_THRESHOLD(i),
                        &xadc->threshold[i]);