Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f07db1f1 authored by Sven Van Asbroeck's avatar Sven Van Asbroeck Committed by Greg Kroah-Hartman
Browse files

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



[ Upstream commit 2e4b88f73966adead360e47621df0183586fac32 ]

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: default avatarSven Van Asbroeck <TheSven73@gmail.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6400212a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1320,8 +1320,8 @@ static int xadc_remove(struct platform_device *pdev)
		iio_triggered_buffer_cleanup(indio_dev);
		iio_triggered_buffer_cleanup(indio_dev);
	}
	}
	free_irq(xadc->irq, indio_dev);
	free_irq(xadc->irq, indio_dev);
	clk_disable_unprepare(xadc->clk);
	cancel_delayed_work_sync(&xadc->zynq_unmask_work);
	cancel_delayed_work_sync(&xadc->zynq_unmask_work);
	clk_disable_unprepare(xadc->clk);
	kfree(xadc->data);
	kfree(xadc->data);
	kfree(indio_dev->channels);
	kfree(indio_dev->channels);