]> git.baikalelectronics.ru Git - kernel.git/commit
spi: spi-qcom-qspi: Use device managed memory for clk_bulk_data
authorMatthias Kaehlcke <mka@chromium.org>
Wed, 8 Jan 2020 21:40:32 +0000 (13:40 -0800)
committerMark Brown <broonie@kernel.org>
Mon, 13 Jan 2020 15:04:40 +0000 (15:04 +0000)
commitb678b5c85c29eb62e811eea5c5162067a8433318
tree742bdcb7a5c47991d97108086cb88215465fa71a
parent5233a671493d76eed9d6fd2c50fae32865218ad5
spi: spi-qcom-qspi: Use device managed memory for clk_bulk_data

Currrently the memory for the clk_bulk_data of the QSPI controller
is allocated with spi_alloc_master(). The bulk data pointer is passed
to devm_clk_bulk_get() which saves it in clk_bulk_devres->clks. When
the device is removed later devm_clk_bulk_release() is called and
uses the bulk data referenced by the pointer to release the clocks.
For this driver this results in accessing memory that has already
been freed, since the memory allocated with spi_alloc_master() is
released by spi_controller_release(), which is called before the
managed resources are released.

Use device managed memory for the clock bulk data to fix the issue
described above.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20200108133948.1.I35ceb4db3ad8cfab78f7cd51494aeff4891339f5@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-qcom-qspi.c