]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
spi: fsl-qspi: Fix double cleanup in probe error path
authorKevin Hao <haokexin@gmail.com>
Thu, 10 Apr 2025 06:56:09 +0000 (14:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 6 Jul 2025 09:01:50 +0000 (11:01 +0200)
commit270165467169795280d89006e6bdfaedfae16ac7
treeb78413b72fcb4912132534d43d081350f1832132
parent07836bc18f4ae42da4e922244f4685561c18755e
spi: fsl-qspi: Fix double cleanup in probe error path

[ Upstream commit 5d07ab2a7fa1305e429d9221716582f290b58078 ]

Commit 40369bfe717e ("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: 40369bfe717e ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-fsl-qspi.c