diff mbox series

[1/5] thermal/core: Fix unregistering netlink at thermal init time

Message ID 20230118211123.111493-1-daniel.lezcano@linaro.org (mailing list archive)
State Superseded, archived
Headers show
Series [1/5] thermal/core: Fix unregistering netlink at thermal init time | expand

Commit Message

Daniel Lezcano Jan. 18, 2023, 9:11 p.m. UTC
The thermal subsystem initialization miss an netlink unregistering
function in the error. Add it.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/thermal_core.c    | 4 +++-
 drivers/thermal/thermal_netlink.c | 5 +++++
 drivers/thermal/thermal_netlink.h | 3 +++
 3 files changed, 11 insertions(+), 1 deletion(-)

Comments

Rafael J. Wysocki Jan. 19, 2023, 1:28 p.m. UTC | #1
On Wed, Jan 18, 2023 at 10:11 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> The thermal subsystem initialization miss an netlink unregistering
> function in the error. Add it.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

What tree is this series based on?

> ---
>  drivers/thermal/thermal_core.c    | 4 +++-
>  drivers/thermal/thermal_netlink.c | 5 +++++
>  drivers/thermal/thermal_netlink.h | 3 +++
>  3 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index d9a3d9566d73..fddafcee5e6f 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1606,7 +1606,7 @@ static int __init thermal_init(void)
>
>         result = thermal_register_governors();
>         if (result)
> -               goto error;
> +               goto unregister_netlink;
>
>         result = class_register(&thermal_class);
>         if (result)
> @@ -1621,6 +1621,8 @@ static int __init thermal_init(void)
>
>  unregister_governors:
>         thermal_unregister_governors();
> +unregister_netlink:
> +       thermal_netlink_exit();
>  error:
>         ida_destroy(&thermal_tz_ida);
>         ida_destroy(&thermal_cdev_ida);
> diff --git a/drivers/thermal/thermal_netlink.c b/drivers/thermal/thermal_netlink.c
> index 75943b06dbe7..08bc46c3ec7b 100644
> --- a/drivers/thermal/thermal_netlink.c
> +++ b/drivers/thermal/thermal_netlink.c
> @@ -699,3 +699,8 @@ int __init thermal_netlink_init(void)
>  {
>         return genl_register_family(&thermal_gnl_family);
>  }
> +
> +void __init thermal_netlink_exit(void)
> +{
> +       genl_unregister_family(&thermal_gnl_family);
> +}
> diff --git a/drivers/thermal/thermal_netlink.h b/drivers/thermal/thermal_netlink.h
> index 1052f523188d..0a9987c3bc57 100644
> --- a/drivers/thermal/thermal_netlink.h
> +++ b/drivers/thermal/thermal_netlink.h
> @@ -13,6 +13,7 @@ struct thermal_genl_cpu_caps {
>  /* Netlink notification function */
>  #ifdef CONFIG_THERMAL_NETLINK
>  int __init thermal_netlink_init(void);
> +void __init thermal_netlink_exit(void);
>  int thermal_notify_tz_create(int tz_id, const char *name);
>  int thermal_notify_tz_delete(int tz_id);
>  int thermal_notify_tz_enable(int tz_id);
> @@ -115,4 +116,6 @@ static inline int thermal_genl_cpu_capability_event(int count, struct thermal_ge
>         return 0;
>  }
>
> +static inline void __init thermal_netlink_exit(void) {}
> +
>  #endif /* CONFIG_THERMAL_NETLINK */
> --
> 2.34.1
>
Daniel Lezcano Jan. 19, 2023, 1:40 p.m. UTC | #2
On 19/01/2023 14:28, Rafael J. Wysocki wrote:
> On Wed, Jan 18, 2023 at 10:11 PM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>>
>> The thermal subsystem initialization miss an netlink unregistering
>> function in the error. Add it.
>>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> 
> What tree is this series based on?

It is based on 
https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/log/?h=thermal/linux-next
Rafael J. Wysocki Jan. 19, 2023, 1:45 p.m. UTC | #3
On Thu, Jan 19, 2023 at 2:40 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> On 19/01/2023 14:28, Rafael J. Wysocki wrote:
> > On Wed, Jan 18, 2023 at 10:11 PM Daniel Lezcano
> > <daniel.lezcano@linaro.org> wrote:
> >>
> >> The thermal subsystem initialization miss an netlink unregistering
> >> function in the error. Add it.
> >>
> >> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> >
> > What tree is this series based on?
>
> It is based on
> https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/log/?h=thermal/linux-next

OK

Can this information be added to the patches or to a cover letter of
the series next time?
Daniel Lezcano Jan. 19, 2023, 2:07 p.m. UTC | #4
On 19/01/2023 14:45, Rafael J. Wysocki wrote:
> On Thu, Jan 19, 2023 at 2:40 PM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>>
>> On 19/01/2023 14:28, Rafael J. Wysocki wrote:
>>> On Wed, Jan 18, 2023 at 10:11 PM Daniel Lezcano
>>> <daniel.lezcano@linaro.org> wrote:
>>>>
>>>> The thermal subsystem initialization miss an netlink unregistering
>>>> function in the error. Add it.
>>>>
>>>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>>>
>>> What tree is this series based on?
>>
>> It is based on
>> https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/log/?h=thermal/linux-next
> 
> OK
> 
> Can this information be added to the patches or to a cover letter of
> the series next time?

Sure
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d9a3d9566d73..fddafcee5e6f 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1606,7 +1606,7 @@  static int __init thermal_init(void)
 
 	result = thermal_register_governors();
 	if (result)
-		goto error;
+		goto unregister_netlink;
 
 	result = class_register(&thermal_class);
 	if (result)
@@ -1621,6 +1621,8 @@  static int __init thermal_init(void)
 
 unregister_governors:
 	thermal_unregister_governors();
+unregister_netlink:
+	thermal_netlink_exit();
 error:
 	ida_destroy(&thermal_tz_ida);
 	ida_destroy(&thermal_cdev_ida);
diff --git a/drivers/thermal/thermal_netlink.c b/drivers/thermal/thermal_netlink.c
index 75943b06dbe7..08bc46c3ec7b 100644
--- a/drivers/thermal/thermal_netlink.c
+++ b/drivers/thermal/thermal_netlink.c
@@ -699,3 +699,8 @@  int __init thermal_netlink_init(void)
 {
 	return genl_register_family(&thermal_gnl_family);
 }
+
+void __init thermal_netlink_exit(void)
+{
+	genl_unregister_family(&thermal_gnl_family);
+}
diff --git a/drivers/thermal/thermal_netlink.h b/drivers/thermal/thermal_netlink.h
index 1052f523188d..0a9987c3bc57 100644
--- a/drivers/thermal/thermal_netlink.h
+++ b/drivers/thermal/thermal_netlink.h
@@ -13,6 +13,7 @@  struct thermal_genl_cpu_caps {
 /* Netlink notification function */
 #ifdef CONFIG_THERMAL_NETLINK
 int __init thermal_netlink_init(void);
+void __init thermal_netlink_exit(void);
 int thermal_notify_tz_create(int tz_id, const char *name);
 int thermal_notify_tz_delete(int tz_id);
 int thermal_notify_tz_enable(int tz_id);
@@ -115,4 +116,6 @@  static inline int thermal_genl_cpu_capability_event(int count, struct thermal_ge
 	return 0;
 }
 
+static inline void __init thermal_netlink_exit(void) {}
+
 #endif /* CONFIG_THERMAL_NETLINK */