Commit 57078a3c authored by Tong Zhang's avatar Tong Zhang Committed by Greg Kroah-Hartman
Browse files

staging: rtl8192u: rework init and exit function



The init and exit functions are not releasing resource properly. An error
can be observed when we load/unload/load r8192u_usb module due to this
issue. This patch rework init and exit functions to do proper resource
release on init error and module unload.
The __exit attribute is stripped from some functions since they are now
being used by module init functions.

[  493.068012] proc_dir_entry 'net/ieee80211' already registered
[  493.271973]  proc_mkdir+0x18/0x20
[  493.272136]  ieee80211_debug_init+0x28/0xde8 [r8192u_usb]
[  493.272404]  rtl8192_usb_module_init+0x10/0x161 [r8192u_usb]

[   13.910616] proc_dir_entry 'net/rtl819xU' already registered
[   13.918931]  proc_mkdir+0x18/0x20
[   13.919098]  rtl8192_usb_module_init+0x142/0x16d [r8192u_usb]

Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTong Zhang <ztong0001@gmail.com>
Link: https://lore.kernel.org/r/20220224064033.1530924-3-ztong0001@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 907f6fae
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -214,7 +214,7 @@ int __init ieee80211_crypto_init(void)
	return ret;
}

void __exit ieee80211_crypto_deinit(void)
void ieee80211_crypto_deinit(void)
{
	struct list_head *ptr, *n;

+1 −1
Original line number Diff line number Diff line
@@ -415,7 +415,7 @@ int __init ieee80211_crypto_ccmp_init(void)
	return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
}

void __exit ieee80211_crypto_ccmp_exit(void)
void ieee80211_crypto_ccmp_exit(void)
{
	ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
}
+1 −1
Original line number Diff line number Diff line
@@ -712,7 +712,7 @@ int __init ieee80211_crypto_tkip_init(void)
	return ieee80211_register_crypto_ops(&ieee80211_crypt_tkip);
}

void __exit ieee80211_crypto_tkip_exit(void)
void ieee80211_crypto_tkip_exit(void)
{
	ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
}
+1 −1
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ int __init ieee80211_crypto_wep_init(void)
	return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
}

void __exit ieee80211_crypto_wep_exit(void)
void ieee80211_crypto_wep_exit(void)
{
	ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
}
+1 −1
Original line number Diff line number Diff line
@@ -276,7 +276,7 @@ int __init ieee80211_debug_init(void)
	return 0;
}

void __exit ieee80211_debug_exit(void)
void ieee80211_debug_exit(void)
{
	if (ieee80211_proc) {
		remove_proc_entry("debug_level", ieee80211_proc);
Loading