[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <92a6e8494b92f0bb8cb36c98d2237ee3d347c358.camel@intel.com>
Date: Thu, 19 Jan 2023 07:41:26 +0000
From: "Zhang, Rui" <rui.zhang@...el.com>
To: "rafael@...nel.org" <rafael@...nel.org>,
"daniel.lezcano@...aro.org" <daniel.lezcano@...aro.org>
CC: "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"amitk@...nel.org" <amitk@...nel.org>
Subject: Re: [PATCH 3/5] thermal/core: Remove unneeded mutex_destroy()
On Wed, 2023-01-18 at 22:11 +0100, Daniel Lezcano wrote:
> If the thermal framework fails to initialize, the mutex can be used
> by
> the different functions registering a thermal zone anyway.
Hmm, even with no governors and unregistered thermal sysfs class?
IMO, thermal APIs for registering a thermal_zone/cooling_device should
yield early if thermal_init fails.
For other APIs that relies on a valid
thermal_zone_device/thermal_cooling_device pointer, nothing needs to
be changed.
what do you think?
thanks,
rui
> We should
> not destroy the mutexes as other components may use them.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
> ---
> drivers/thermal/thermal_core.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.c
> b/drivers/thermal/thermal_core.c
> index fad0c4a07d16..ea78c93277be 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1602,7 +1602,7 @@ static int __init thermal_init(void)
>
> result = thermal_netlink_init();
> if (result)
> - goto error;
> + return result;
>
> result = thermal_register_governors();
> if (result)
> @@ -1623,9 +1623,7 @@ static int __init thermal_init(void)
> thermal_unregister_governors();
> unregister_netlink:
> thermal_netlink_exit();
> -error:
> - mutex_destroy(&thermal_list_lock);
> - mutex_destroy(&thermal_governor_lock);
> +
> return result;
> }
> postcore_initcall(thermal_init);
Powered by blists - more mailing lists