lkml.org 
[lkml]   [2019]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 4.19 03/81] iio: adc: xilinx: prevent touching unclocked h/w on remove
    Date
    From: Sven Van Asbroeck <thesven73@gmail.com>

    [ 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: Sven Van Asbroeck <TheSven73@gmail.com>
    Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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 15e1a103f37d..1ae86e7359f7 100644
    --- a/drivers/iio/adc/xilinx-xadc-core.c
    +++ b/drivers/iio/adc/xilinx-xadc-core.c
    @@ -1320,8 +1320,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);

    --
    2.20.1
    \
     
     \ /
      Last update: 2019-05-07 08:02    [W:4.118 / U:0.868 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site