Skip to contentSkip to conversation

spi: sprd: call pm_runtime_put if pm_runtime_get_sync fails

PATCH In review Navid Emamdoost 2 participants 2 messages Jun 2, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: sprd: call pm_runtime_put if pm_runtime_get_sync fails

Call to pm_runtime_get_sync increments counter even in case of failure leading to incorrect ref count.
Call pm_runtime_put_noidle if pm_runtime_get_sync fails.

---
 drivers/spi/spi-sprd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/spi/spi-sprd.c +1 -0
index 6678f1cbc566..860032af4b98 100644
@@ -1018,6 +1018,7 @@ static int sprd_spi_remove(struct platform_device *pdev)
 	ret = pm_runtime_get_sync(ss->dev);
 	if (ret < 0) {
 		dev_err(ss->dev, "failed to resume SPI controller\n");
+		pm_runtime_put_noidle(&pdev->dev);
 		return ret;
 	}
 
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 6 lines · Navid Emamdoost

Call to pm_runtime_get_sync increments counter even in case of failure leading to incorrect ref count.
Call pm_runtime_put_noidle if pm_runtime_get_sync fails.

Looks good to me. Thanks

Quoted 19 lines
---
 drivers/spi/spi-sprd.c | 1 +
 1 file changed, 1 insertion(+)
drivers/spi/spi-sprd.c +1 -1
index 6678f1cbc566..860032af4b98 100644
@@ -1018,6 +1018,7 @@ static int sprd_spi_remove(struct platform_device *pdev)
        ret = pm_runtime_get_sync(ss->dev);
        if (ret < 0) {
                dev_err(ss->dev, "failed to resume SPI controller\n");
+               pm_runtime_put_noidle(&pdev->dev);
                return ret;
        }
 
--

2.17.1

Signature · 1 line
Baolin Wang