Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: spi-cadence-quadspi: Enable pm runtime earlier to avoid imbalance

The "probe_setup_failed" label calls pm_runtime_disable(), but
pm_runtime_enable() was placed after a possible jump to this label.
When cqspi_setup_flash() fails, control jumps to the label without
pm_runtime_enable() being called, leading to unbalanced PM runtime
reference counting.

Move pm_runtime_enable() and associated calls above the first
possible branch to "probe_setup_failed" to ensure balanced
enable/disable calls across all error paths.

Fixes: 30dbc1c8d50f ("spi: cadence-qspi: defer runtime support on socfpga if reset bit is enabled")
Signed-off-by: Anurag Dutta <a-dutta@ti.com>
Link: https://patch.msgid.link/20251105161146.2019090-2-a-dutta@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Anurag Dutta and committed by
Mark Brown
f1eb4e79 66e9feb0

+7 -7
+7 -7
drivers/spi/spi-cadence-quadspi.c
··· 1981 1981 cqspi->current_cs = -1; 1982 1982 cqspi->sclk = 0; 1983 1983 1984 + if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { 1985 + pm_runtime_enable(dev); 1986 + pm_runtime_set_autosuspend_delay(dev, CQSPI_AUTOSUSPEND_TIMEOUT); 1987 + pm_runtime_use_autosuspend(dev); 1988 + pm_runtime_get_noresume(dev); 1989 + } 1990 + 1984 1991 ret = cqspi_setup_flash(cqspi); 1985 1992 if (ret) { 1986 1993 dev_err(dev, "failed to setup flash parameters %d\n", ret); ··· 2003 1996 ret = cqspi_request_mmap_dma(cqspi); 2004 1997 if (ret == -EPROBE_DEFER) 2005 1998 goto probe_dma_failed; 2006 - } 2007 - 2008 - if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { 2009 - pm_runtime_enable(dev); 2010 - pm_runtime_set_autosuspend_delay(dev, CQSPI_AUTOSUSPEND_TIMEOUT); 2011 - pm_runtime_use_autosuspend(dev); 2012 - pm_runtime_get_noresume(dev); 2013 1999 } 2014 2000 2015 2001 ret = spi_register_controller(host);