]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
spi: cadence-qspi: Fix exec_mem_op error handling
authorEmanuele Ghidoli <emanuele.ghidoli@toradex.com>
Fri, 13 Mar 2026 13:52:31 +0000 (14:52 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 30 Mar 2026 20:34:53 +0000 (21:34 +0100)
commit59e1be1278f064d7172b00473b7e0c453cb1ec52
treebba6ff4ac570b669fd360a768514e019ad28388f
parentb0dc7e7c56573e7a52080f25f3179a45f3dd7e6f
spi: cadence-qspi: Fix exec_mem_op error handling

cqspi_exec_mem_op() increments the runtime PM usage counter before all
refcount checks are performed. If one of these checks fails, the function
returns without dropping the PM reference.

Move the pm_runtime_resume_and_get() call after the refcount checks so
that runtime PM is only acquired when the operation can proceed and
drop the inflight_ops refcount if the PM resume fails.

Cc: stable@vger.kernel.org
Fixes: 7446284023e8 ("spi: cadence-quadspi: Implement refcount to handle unbind during busy")
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Link: https://patch.msgid.link/20260313135236.46642-1-ghidoliemanuele@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-cadence-quadspi.c