Skip to content

Commit 5d07ab2

Browse files
haokexinbroonie
authored andcommitted
spi: fsl-qspi: Fix double cleanup in probe error path
Commit 40369bf ("spi: fsl-qspi: use devm function instead of driver remove") introduced managed cleanup via fsl_qspi_cleanup(), but incorrectly retain manual cleanup in two scenarios: - On devm_add_action_or_reset() failure, the function automatically call fsl_qspi_cleanup(). However, the current code still jumps to err_destroy_mutex, repeating cleanup. - After the fsl_qspi_cleanup() action is added successfully, there is no need to manually perform the cleanup in the subsequent error path. However, the current code still jumps to err_destroy_mutex on spi controller failure, repeating cleanup. Skip redundant manual cleanup calls to fix these issues. Cc: stable@vger.kernel.org Fixes: 40369bf ("spi: fsl-qspi: use devm function instead of driver remove") Signed-off-by: Kevin Hao <haokexin@gmail.com> Link: https://patch.msgid.link/20250410-spi-v1-1-56e867cc19cf@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 0af2f6b commit 5d07ab2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/spi/spi-fsl-qspi.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -949,17 +949,14 @@ static int fsl_qspi_probe(struct platform_device *pdev)
949949

950950
ret = devm_add_action_or_reset(dev, fsl_qspi_cleanup, q);
951951
if (ret)
952-
goto err_destroy_mutex;
952+
goto err_put_ctrl;
953953

954954
ret = devm_spi_register_controller(dev, ctlr);
955955
if (ret)
956-
goto err_destroy_mutex;
956+
goto err_put_ctrl;
957957

958958
return 0;
959959

960-
err_destroy_mutex:
961-
mutex_destroy(&q->lock);
962-
963960
err_disable_clk:
964961
fsl_qspi_clk_disable_unprep(q);
965962

0 commit comments

Comments
 (0)