Skip to contentSkip to conversation

gpio: zynq: fix runtime PM leak on remove

PATCH Applied Ruoyu Wang 3 participants 3 messages Jun 9

Subsystems (3)
lore
Share & tools
lore

Ruoyu Wang

author
#0 lore raw

PATCH 1/1 gpio: zynq: fix runtime PM leak on remove

pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error. zynq_gpio_remove() uses it to keep the controller active while removing the GPIO chip, but never drops the usage counter again.

Balance the get with pm_runtime_put_noidle() after disabling runtime PM.

Fixes 3242ba117e9b ("gpio: Add driver for Zynq GPIO controller")
---
 drivers/gpio/gpio-zynq.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpio/gpio-zynq.c +1 -0
index 571e366624d2a..fafca91128b2e 100644
@@ -1014,6 +1014,7 @@ static void zynq_gpio_remove(struct platform_device *pdev)
 	gpiochip_remove(&gpio->chip);
 	device_set_wakeup_capable(&pdev->dev, 0);
 	pm_runtime_disable(&pdev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
 }
 
 static struct platform_driver zynq_gpio_driver = {
Signature · 1 line
2.51.0
#1 lore raw
Quoted 8 lines · Ruoyu Wang

pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error. zynq_gpio_remove() uses it to keep the controller active while removing the GPIO chip, but never drops the usage counter again.

Balance the get with pm_runtime_put_noidle() after disabling runtime PM.

[...]

Applied, thanks!

[1/1] gpio: zynq: fix runtime PM leak on remove

      https://git.kernel.org/brgl/c/6edb934de9bda3b7abcec856eaee6fc8b4278dd1

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>
Reviewed-by Radhey Shyam Pandey on v1 1/1
#2 lore raw
In reply to Ruoyu Wang
Quoted 8 lines

pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error. zynq_gpio_remove() uses it to keep the controller active while removing the GPIO chip, but never drops the usage counter again.

Balance the get with pm_runtime_put_noidle() after disabling runtime PM.

Fixes 3242ba117e9b ("gpio: Add driver for Zynq GPIO controller")

Thanks!

Quoted 16 lines
---
  drivers/gpio/gpio-zynq.c | 1 +
  1 file changed, 1 insertion(+)
drivers/gpio/gpio-zynq.c +1 -0
index 571e366624d2a..fafca91128b2e 100644
@@ -1014,6 +1014,7 @@ static void zynq_gpio_remove(struct platform_device *pdev)
  	gpiochip_remove(&gpio->chip);
  	device_set_wakeup_capable(&pdev->dev, 0);
  	pm_runtime_disable(&pdev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
  }
 
  static struct platform_driver zynq_gpio_driver = {