Skip to content

Commit 58d1c9f

Browse files
dlezcanorafaeljw
authored andcommitted
thermal/core: Fix unregistering netlink at thermal init time
The thermal subsystem initialization miss an netlink unregistering function in the error. Add it. Signed-off-by: Daniel Lezcano <[email protected]> Reviewed-by: Zhang Rui <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 47e3f00 commit 58d1c9f

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

drivers/thermal/thermal_core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,7 @@ static int __init thermal_init(void)
16071607

16081608
result = thermal_register_governors();
16091609
if (result)
1610-
goto error;
1610+
goto unregister_netlink;
16111611

16121612
result = class_register(&thermal_class);
16131613
if (result)
@@ -1622,6 +1622,8 @@ static int __init thermal_init(void)
16221622

16231623
unregister_governors:
16241624
thermal_unregister_governors();
1625+
unregister_netlink:
1626+
thermal_netlink_exit();
16251627
error:
16261628
ida_destroy(&thermal_tz_ida);
16271629
ida_destroy(&thermal_cdev_ida);

drivers/thermal/thermal_netlink.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,3 +699,8 @@ int __init thermal_netlink_init(void)
699699
{
700700
return genl_register_family(&thermal_gnl_family);
701701
}
702+
703+
void __init thermal_netlink_exit(void)
704+
{
705+
genl_unregister_family(&thermal_gnl_family);
706+
}

drivers/thermal/thermal_netlink.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ struct thermal_genl_cpu_caps {
1313
/* Netlink notification function */
1414
#ifdef CONFIG_THERMAL_NETLINK
1515
int __init thermal_netlink_init(void);
16+
void __init thermal_netlink_exit(void);
1617
int thermal_notify_tz_create(int tz_id, const char *name);
1718
int thermal_notify_tz_delete(int tz_id);
1819
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
115116
return 0;
116117
}
117118

119+
static inline void __init thermal_netlink_exit(void) {}
120+
118121
#endif /* CONFIG_THERMAL_NETLINK */

0 commit comments

Comments
 (0)