* [PATCH] spi: ma35d1-qspi: assert reset on probe error paths
@ 2026-09-01 2:51 Li Youhong
0 siblings, 0 replies; only message in thread
From: Li Youhong @ 2026-09-01 2:51 UTC (permalink / raw)
To: ychuang3, schung, broonie; +Cc: linux-arm-kernel, linux-spi, Li Youhong
From: Li Youhong <liyouhong@kylinos.cn>
nuvoton_qspi_probe() pulses the exclusive reset and leaves it
deasserted for normal operation. Later probe failures returned
without re-asserting the reset, leaving the controller out of
reset after a failed probe. Assert the reset on those error
paths.
Fixes: 78b16af159ae ("spi: ma35d1-qspi: Add Nuvoton MA35D1 QSPI controller support")
Signed-off-by: Li Youhong <liyouhong@kylinos.cn>
---
drivers/spi/spi-ma35d1-qspi.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/drivers/spi/spi-ma35d1-qspi.c b/drivers/spi/spi-ma35d1-qspi.c
index 7f938d0c6f1f..cf731fa2f7e2 100644
--- a/drivers/spi/spi-ma35d1-qspi.c
+++ b/drivers/spi/spi-ma35d1-qspi.c
@@ -633,12 +633,16 @@ static int nuvoton_qspi_probe(struct platform_device *pdev)
return dev_err_probe(dev, ret, "failed to deassert reset\n");
ret = device_property_read_u32(dev, "num-cs", &num_cs);
- if (ret && ret != -EINVAL)
- return dev_err_probe(dev, ret, "failed to read num-cs\n");
+ if (ret && ret != -EINVAL) {
+ ret = dev_err_probe(dev, ret, "failed to read num-cs\n");
+ goto err_assert;
+ }
- if (!num_cs || num_cs > NUVOTON_QSPI_MAX_NUM_CS)
- return dev_err_probe(dev, -EINVAL, "invalid num-cs %u\n",
+ if (!num_cs || num_cs > NUVOTON_QSPI_MAX_NUM_CS) {
+ ret = dev_err_probe(dev, -EINVAL, "invalid num-cs %u\n",
num_cs);
+ goto err_assert;
+ }
ctlr->num_chipselect = num_cs;
ctlr->max_transfer_size = nuvoton_qspi_max_transfer_size;
@@ -655,14 +659,20 @@ static int nuvoton_qspi_probe(struct platform_device *pdev)
ret = nuvoton_qspi_hw_init(qspi);
if (ret)
- return ret;
+ goto err_assert;
ret = devm_spi_register_controller(dev, ctlr);
- if (ret)
- return dev_err_probe(dev, ret,
- "failed to register spi controller\n");
+ if (ret) {
+ ret = dev_err_probe(dev, ret,
+ "failed to register spi controller\n");
+ goto err_assert;
+ }
return 0;
+
+err_assert:
+ reset_control_assert(rst);
+ return ret;
}
static const struct of_device_id nuvoton_qspi_of_match[] = {
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-01 2:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 2:51 [PATCH] spi: ma35d1-qspi: assert reset on probe error paths Li Youhong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox