Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e9d7f86 authored by David Herrmann's avatar David Herrmann Committed by Gustavo Padovan
Browse files

Bluetooth: discard bt_sock_unregister() errors



After we successfully registered a socket via bt_sock_register() there is
no reason to ever check the return code of bt_sock_unregister(). If
bt_sock_unregister() fails, it means the socket _is_ already unregistered
so we have what we want, don't we?

Also, to get bt_sock_unregister() to fail, another part of the kernel has
to unregister _our_ socket. This is sooo _wrong_ that it will break way
earlier than when we unregister our socket.

Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
parent fd86c9be
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -253,8 +253,6 @@ int __init bnep_sock_init(void)
void __exit bnep_sock_cleanup(void)
{
	bt_procfs_cleanup(&init_net, "bnep");
	if (bt_sock_unregister(BTPROTO_BNEP) < 0)
		BT_ERR("Can't unregister BNEP socket");

	bt_sock_unregister(BTPROTO_BNEP);
	proto_unregister(&bnep_proto);
}
+1 −3
Original line number Diff line number Diff line
@@ -264,8 +264,6 @@ int cmtp_init_sockets(void)
void cmtp_cleanup_sockets(void)
{
	bt_procfs_cleanup(&init_net, "cmtp");
	if (bt_sock_unregister(BTPROTO_CMTP) < 0)
		BT_ERR("Can't unregister CMTP socket");

	bt_sock_unregister(BTPROTO_CMTP);
	proto_unregister(&cmtp_proto);
}
+1 −3
Original line number Diff line number Diff line
@@ -1121,8 +1121,6 @@ int __init hci_sock_init(void)
void hci_sock_cleanup(void)
{
	bt_procfs_cleanup(&init_net, "hci");
	if (bt_sock_unregister(BTPROTO_HCI) < 0)
		BT_ERR("HCI socket unregistration failed");

	bt_sock_unregister(BTPROTO_HCI);
	proto_unregister(&hci_sk_proto);
}
+1 −3
Original line number Diff line number Diff line
@@ -304,8 +304,6 @@ int __init hidp_init_sockets(void)
void __exit hidp_cleanup_sockets(void)
{
	bt_procfs_cleanup(&init_net, "hidp");
	if (bt_sock_unregister(BTPROTO_HIDP) < 0)
		BT_ERR("Can't unregister HIDP socket");

	bt_sock_unregister(BTPROTO_HIDP);
	proto_unregister(&hidp_proto);
}
+1 −3
Original line number Diff line number Diff line
@@ -1312,8 +1312,6 @@ int __init l2cap_init_sockets(void)
void l2cap_cleanup_sockets(void)
{
	bt_procfs_cleanup(&init_net, "l2cap");
	if (bt_sock_unregister(BTPROTO_L2CAP) < 0)
		BT_ERR("L2CAP socket unregistration failed");

	bt_sock_unregister(BTPROTO_L2CAP);
	proto_unregister(&l2cap_proto);
}
Loading