* [PATCH] spi: wpcm-fiu: Check the error of the SHM syscon lookup
@ 2026-12-01 11:34 Anton Protopopov
0 siblings, 0 replies; only message in thread
From: Anton Protopopov @ 2026-12-01 11:34 UTC (permalink / raw)
To: Jonathan Neuschäfer, Mark Brown, openbmc, linux-spi, linux-kernel
Cc: Anton Protopopov, Bjorn Helgaas
The syscon_regmap_lookup_by_phandle_optional() function returns NULL
only when the property is missing (-ENODEV). On other errors it
returns an error pointer. The wpcm_fiu_probe() function stores it in
fiu->shm_regmap and wpcm_fiu_stall_host() checks only for NULL. It
passes the error pointer to regmap_update_bits(), which leads to an
oops on the first operation.
The lookup may fail with a correct device tree too: it returns
-EPROBE_DEFER when the hwspinlock of the syscon or the driver which
registers its regmap is not probed yet. Return the error from the
probe, so that it is retried.
Fixes: 1f8811a2613e ("spi: wpcm-fiu: Add driver for Nuvoton WPCM450 Flash Interface Unit (FIU)")
Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
---
It's one of three related changes, but for different trees.
See https://lore.kernel.org/linux-pci/20261127101915.1348807-1-a.s.protopopov@gmail.com/
This applies to the for-next and for-linus branches of
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
drivers/spi/spi-wpcm-fiu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/spi/spi-wpcm-fiu.c b/drivers/spi/spi-wpcm-fiu.c
index 884e5042bad5..6dd77a8de00b 100644
--- a/drivers/spi/spi-wpcm-fiu.c
+++ b/drivers/spi/spi-wpcm-fiu.c
@@ -464,6 +464,9 @@ static int wpcm_fiu_probe(struct platform_device *pdev)
fiu->memory_size = min_t(size_t, resource_size(res), MAX_MEMORY_SIZE_TOTAL);
fiu->shm_regmap = syscon_regmap_lookup_by_phandle_optional(dev->of_node, "nuvoton,shm");
+ if (IS_ERR(fiu->shm_regmap))
+ return dev_err_probe(dev, PTR_ERR(fiu->shm_regmap),
+ "Failed to look up SHM syscon\n");
wpcm_fiu_hw_init(fiu);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-01 11:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-01 11:34 [PATCH] spi: wpcm-fiu: Check the error of the SHM syscon lookup Anton Protopopov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®