iio: adc: xilinx: prevent touching unclocked h/w on remove

This change “iio: adc: xilinx: prevent touching unclocked h/w on remove” (commit 2e4b88f) in Linux kernel is authored by Sven Van Asbroeck <thesven73 [at] gmail.com> on Sun Mar 10 14:58:26 2019 -0400.

Description of "iio: adc: xilinx: prevent touching unclocked h/w on remove"

The change “iio: adc: xilinx: prevent touching unclocked h/w on remove” introduces changes as follows.

iio: adc: xilinx: prevent touching unclocked h/w on remove

In remove, the clock is disabled before canceling the
delayed work. This means that the delayed work may be
touching unclocked hardware.

Fix by disabling the clock after the delayed work is
fully canceled. This is consistent with the probe error
path order.

Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Linux kernel releases containing commit 2e4b88f

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "iio: adc: xilinx: prevent touching unclocked h/w on remove"

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/iio/adc/xilinx-xadc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index 5a1b63f9d041..6401ca7a9a20 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -1322,8 +1322,8 @@ static int xadc_remove(struct platform_device *pdev)
 		iio_triggered_buffer_cleanup(indio_dev);
 	}
 	free_irq(xadc->irq, indio_dev);
-	clk_disable_unprepare(xadc->clk);
 	cancel_delayed_work_sync(&xadc->zynq_unmask_work);
+	clk_disable_unprepare(xadc->clk);
 	kfree(xadc->data);
 	kfree(indio_dev->channels);
 

The commit for this change in Linux stable tree is 2e4b88f (patch).

Last modified: 2020/02/09