gpio: arizona: put pm_runtime in case of failure
Subsystems (2)
PATCH 1/1 gpio: arizona: put pm_runtime in case of failure
Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count if pm_runtime_put is not called in error handling paths. Call pm_runtime_put if pm_runtime_get_sync fails.
Signed-off-by Navid Emamdoost <[email protected]>
--- drivers/gpio/gpio-arizona.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpio/gpio-arizona.c +5 -1
@@ -64,6 +64,7 @@ static int arizona_gpio_get(struct gpio_chip *chip, unsigned offset) ret =pm_runtime_get_sync (chip->parent);if (ret <0 ) {dev_err (chip->parent,"Failed to resume: %d\n" , ret); +pm_runtime_put_autosuspend (chip->parent);return ret; }
@@ -72,12 +73,15 @@ static int arizona_gpio_get(struct gpio_chip *chip, unsigned offset)if (ret <0 ) {dev_err (chip->parent,"Failed to drop cache: %d\n" , ret); +pm_runtime_put_autosuspend (chip->parent);return ret; } ret =regmap_read (arizona->regmap, reg, &val); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_autosuspend (chip->parent);return ret; + }pm_runtime_mark_last_busy (chip->parent);pm_runtime_put_autosuspend (chip->parent);
Signature · 1 line
2.17.1
Quoted 6 lines · Navid Emamdoost
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count ifpm_runtime_putis not called in error handling paths. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>---
Acked-by Charles Keepax <[email protected]>
Thanks,
Charles
Quoted 5 lines · Navid Emamdoost
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count ifpm_runtime_putis not called in error handling paths. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>
Patch applied for fixes.
Yours,
Linus Walleij