thermal/debugfs: Unlock on error path in thermal_debug_tz_trip_up()

Message ID efe2a897-4af0-4204-8105-1bee7d6b9380@moroto.mountain
State New
Headers
Series thermal/debugfs: Unlock on error path in thermal_debug_tz_trip_up() |

Commit Message

Dan Carpenter Jan. 12, 2024, 2:30 p.m. UTC
  Add a missing mutex_unlock(&thermal_dbg->lock) to this error path.

Fixes: 4731c8f16a0e ("thermal/debugfs: Add thermal debugfs information for mitigation episodes")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/thermal/thermal_debugfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Rafael J. Wysocki Jan. 12, 2024, 2:56 p.m. UTC | #1
On Fri, Jan 12, 2024 at 3:30 PM Dan Carpenter <dan.carpenter@linaroorg> wrote:
>
> Add a missing mutex_unlock(&thermal_dbg->lock) to this error path.
>
> Fixes: 4731c8f16a0e ("thermal/debugfs: Add thermal debugfs information for mitigation episodes")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/thermal/thermal_debugfs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_debugfs.c b/drivers/thermal/thermal_debugfs.c
> index a3fa09235da1..a3f06029fc54 100644
> --- a/drivers/thermal/thermal_debugfs.c
> +++ b/drivers/thermal/thermal_debugfs.c
> @@ -591,7 +591,7 @@ void thermal_debug_tz_trip_up(struct thermal_zone_device *tz,
>         if (!tz_dbg->nr_trips) {
>                 tze = thermal_debugfs_tz_event_alloc(tz, now);
>                 if (!tze)
> -                       return;
> +                       goto unlock;
>
>                 list_add(&tze->node, &tz_dbg->tz_episodes);
>         }
> @@ -619,6 +619,7 @@ void thermal_debug_tz_trip_up(struct thermal_zone_device *tz,
>                 (temperature - tze->trip_stats[trip_id].avg) /
>                 tze->trip_stats[trip_id].count;
>
> +unlock:
>         mutex_unlock(&thermal_dbg->lock);
>  }
>
> --

Applied, thanks!
  

Patch

diff --git a/drivers/thermal/thermal_debugfs.c b/drivers/thermal/thermal_debugfs.c
index a3fa09235da1..a3f06029fc54 100644
--- a/drivers/thermal/thermal_debugfs.c
+++ b/drivers/thermal/thermal_debugfs.c
@@ -591,7 +591,7 @@  void thermal_debug_tz_trip_up(struct thermal_zone_device *tz,
 	if (!tz_dbg->nr_trips) {
 		tze = thermal_debugfs_tz_event_alloc(tz, now);
 		if (!tze)
-			return;
+			goto unlock;
 
 		list_add(&tze->node, &tz_dbg->tz_episodes);
 	}
@@ -619,6 +619,7 @@  void thermal_debug_tz_trip_up(struct thermal_zone_device *tz,
 		(temperature - tze->trip_stats[trip_id].avg) /
 		tze->trip_stats[trip_id].count;
 
+unlock:
 	mutex_unlock(&thermal_dbg->lock);
 }