mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 23:24:22 -04:00
i2c: stm32f7: fix & reorder remove & probe error handling
[ Upstream commit 53aaaa5d9b1e95eb40e877fbffa6f964a8394bb7 ]
Add missing dma channels free calls in case of error during probe
and reorder the remove function so that dma channels are freed after
the i2c adapter is deleted.
Overall, reorder the remove function so that probe error handling order
and remove function order are same.
Fixes: 7ecc8cfde5 ("i2c: i2c-stm32f7: Add DMA support")
Signed-off-by: Alain Volmat <alain.volmat@st.com>
Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6b1400f260
commit
1558fadfca
1 changed files with 12 additions and 7 deletions
|
|
@ -1985,6 +1985,11 @@ pm_disable:
|
|||
pm_runtime_set_suspended(i2c_dev->dev);
|
||||
pm_runtime_dont_use_autosuspend(i2c_dev->dev);
|
||||
|
||||
if (i2c_dev->dma) {
|
||||
stm32_i2c_dma_free(i2c_dev->dma);
|
||||
i2c_dev->dma = NULL;
|
||||
}
|
||||
|
||||
clk_free:
|
||||
clk_disable_unprepare(i2c_dev->clk);
|
||||
|
||||
|
|
@ -1995,21 +2000,21 @@ static int stm32f7_i2c_remove(struct platform_device *pdev)
|
|||
{
|
||||
struct stm32f7_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
|
||||
|
||||
if (i2c_dev->dma) {
|
||||
stm32_i2c_dma_free(i2c_dev->dma);
|
||||
i2c_dev->dma = NULL;
|
||||
}
|
||||
|
||||
i2c_del_adapter(&i2c_dev->adap);
|
||||
pm_runtime_get_sync(i2c_dev->dev);
|
||||
|
||||
clk_disable_unprepare(i2c_dev->clk);
|
||||
|
||||
pm_runtime_put_noidle(i2c_dev->dev);
|
||||
pm_runtime_disable(i2c_dev->dev);
|
||||
pm_runtime_set_suspended(i2c_dev->dev);
|
||||
pm_runtime_dont_use_autosuspend(i2c_dev->dev);
|
||||
|
||||
if (i2c_dev->dma) {
|
||||
stm32_i2c_dma_free(i2c_dev->dma);
|
||||
i2c_dev->dma = NULL;
|
||||
}
|
||||
|
||||
clk_disable_unprepare(i2c_dev->clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue