diff mbox series

[v3] PM / devfreq: exynos-bus: Disable devfreq-event device when fails

Message ID 20191223004603.7849-1-cw00.choi@samsung.com (mailing list archive)
State Accepted
Delegated to: Chanwoo Choi
Headers show
Series [v3] PM / devfreq: exynos-bus: Disable devfreq-event device when fails | expand

Commit Message

Chanwoo Choi Dec. 23, 2019, 12:46 a.m. UTC
From: Yangtao Li <tiny.windzz@gmail.com>

The exynos_bus_profile_init process may fail, but the devfreq event device
remains enabled. Call devfreq_event_disable_edev on the error return path.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
Changes from v2:
- Just check the return value of exynos_bus_disable_edev()
  and return the error value before jumped goto.

 drivers/devfreq/exynos-bus.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Chanwoo Choi Dec. 23, 2019, 12:47 a.m. UTC | #1
On 12/23/19 9:46 AM, Chanwoo Choi wrote:
> From: Yangtao Li <tiny.windzz@gmail.com>
> 
> The exynos_bus_profile_init process may fail, but the devfreq event device
> remains enabled. Call devfreq_event_disable_edev on the error return path.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
> ---
> Changes from v2:
> - Just check the return value of exynos_bus_disable_edev()
>   and return the error value before jumped goto.
> 
>  drivers/devfreq/exynos-bus.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
> index 7f5917d59072..1259a0da7db7 100644
> --- a/drivers/devfreq/exynos-bus.c
> +++ b/drivers/devfreq/exynos-bus.c
> @@ -335,10 +335,16 @@ static int exynos_bus_profile_init(struct exynos_bus *bus,
>  	ret = exynos_bus_set_event(bus);
>  	if (ret < 0) {
>  		dev_err(dev, "failed to set event to devfreq-event devices\n");
> -		return ret;
> +		goto err_edev;
>  	}
>  
>  	return 0;
> +
> +err_edev:
> +	if (exynos_bus_disable_edev(bus))
> +		dev_warn(dev, "failed to disable the devfreq-event devices\n");
> +
> +	return ret;
>  }
>  
>  static int exynos_bus_profile_init_passive(struct exynos_bus *bus,
> 

Applied it.
diff mbox series

Patch

diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index 7f5917d59072..1259a0da7db7 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -335,10 +335,16 @@  static int exynos_bus_profile_init(struct exynos_bus *bus,
 	ret = exynos_bus_set_event(bus);
 	if (ret < 0) {
 		dev_err(dev, "failed to set event to devfreq-event devices\n");
-		return ret;
+		goto err_edev;
 	}
 
 	return 0;
+
+err_edev:
+	if (exynos_bus_disable_edev(bus))
+		dev_warn(dev, "failed to disable the devfreq-event devices\n");
+
+	return ret;
 }
 
 static int exynos_bus_profile_init_passive(struct exynos_bus *bus,