From: Daniel Lezcano Date: Mon, 23 Jan 2023 15:27:54 +0000 (+0100) Subject: thermal/core: Fix unregistering netlink at thermal init time X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=58d1c9fd0e859912ae322d24aa0baedc9030b8ed;p=linux.git 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 Reviewed-by: Zhang Rui Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index d77c1c45ba880..e79ea015f8d3f 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1607,7 +1607,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) @@ -1622,6 +1622,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 75943b06dbe74..08bc46c3ec7bc 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 1052f523188da..0a9987c3bc578 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 */