]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
spi: amlogic-spifc-a1: Handle devm_pm_runtime_enable() errors
authorHaotian Zhang <vulab@iscas.ac.cn>
Mon, 24 Nov 2025 01:58:52 +0000 (09:58 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Dec 2025 21:24:56 +0000 (06:24 +0900)
[ Upstream commit a90903c2a3c38bce475f46ea3f93dbf6a9971553 ]

devm_pm_runtime_enable() can fail due to memory allocation. The current
code ignores its return value, potentially causing runtime PM operations
to fail silently after autosuspend configuration.

Check the return value of devm_pm_runtime_enable() and return on failure.

Fixes: 909fac05b926 ("spi: add support for Amlogic A1 SPI Flash Controller")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20251124015852.937-1-vulab@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/spi/spi-amlogic-spifc-a1.c

index fadf6667cd51c40a29749b378b82161a337edc62..b430bca4f8bce8076bf7717931f10dce546714ff 100644 (file)
@@ -349,7 +349,9 @@ static int amlogic_spifc_a1_probe(struct platform_device *pdev)
 
        pm_runtime_set_autosuspend_delay(spifc->dev, 500);
        pm_runtime_use_autosuspend(spifc->dev);
-       devm_pm_runtime_enable(spifc->dev);
+       ret = devm_pm_runtime_enable(spifc->dev);
+       if (ret)
+               return ret;
 
        ctrl->num_chipselect = 1;
        ctrl->dev.of_node = pdev->dev.of_node;