drivers/spi/spi-sh-msiof.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sh_msiof_spi_setup() ignores pm_runtime_get_sync() before programming
native chip-select registers and marking the configuration initialized.
Use the checked runtime-PM helper and return failure before register
access.
Fixes: 7ff0b53c4051 ("spi: sh-msiof: Avoid writing to registers from spi_master.setup()")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
drivers/spi/spi-sh-msiof.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index 1aeab7ec0bc8d..4c425ec627767 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -453,6 +453,7 @@ static int sh_msiof_spi_setup(struct spi_device *spi)
struct sh_msiof_spi_priv *p =
spi_controller_get_devdata(spi->controller);
u32 clr, set, tmp;
+ int ret;
if (spi_get_csgpiod(spi, 0) || spi_controller_is_target(p->ctlr))
return 0;
@@ -468,7 +469,9 @@ static int sh_msiof_spi_setup(struct spi_device *spi)
clr |= SIMDR1_SYNCAC;
else
set |= SIMDR1_SYNCAC;
- pm_runtime_get_sync(&p->pdev->dev);
+ ret = pm_runtime_resume_and_get(&p->pdev->dev);
+ if (ret < 0)
+ return ret;
tmp = sh_msiof_read(p, SITMDR1) & ~clr;
sh_msiof_write(p, SITMDR1, tmp | set | SIMDR1_TRMD | SITMDR1_PCON);
tmp = sh_msiof_read(p, SIRMDR1) & ~clr;
base-commit: 08dbfad3f5040f5bdb6c529da20d6d4e81fefd72
--
2.50.1
On Sun, 30 Aug 2026 at 16:10, Pengpeng Hou <pengpeng@iscas.ac.cn> wrote:
> sh_msiof_spi_setup() ignores pm_runtime_get_sync() before programming
> native chip-select registers and marking the configuration initialized.
>
> Use the checked runtime-PM helper and return failure before register
> access.
>
> Fixes: 7ff0b53c4051 ("spi: sh-msiof: Avoid writing to registers from spi_master.setup()")
FTR, this is the wrong commit, please follow moved code.
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Hi Geert, Mark,
Following the code before the move confirms that the unchecked runtime-PM
get was introduced by:
Fixes: 015760563ec7 ("spi: sh-msiof: Add runtime PM lock in initializing")
7ff0b53c4051 moved that operation rather than introducing it. Please use
the tag above for the applied fix if the metadata has not already been
corrected.
Thanks,
Pengpeng
On Sun, 30 Aug 2026 22:01:33 +0800, Pengpeng Hou wrote:
> spi: sh-msiof: propagate setup runtime-PM errors
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.4
Thanks!
[1/1] spi: sh-msiof: propagate setup runtime-PM errors
https://git.kernel.org/broonie/spi/c/152867998da9
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
© 2016 - 2026 Red Hat, Inc.