Bluetooth: hci_core: fix error handling in hci_register_dev()
authorYang Yingliang <yangyingliang@huawei.com>
Thu, 20 Oct 2022 02:16:56 +0000 (10:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:28 +0000 (13:32 +0100)
commit66324c5eb5eea1be5b61fefb12750cfc2118ffa7
treea241cae02744a185aa080eeafffd6fdbd4ebbcb7
parentb17b3203d4797364df11a005aa4d44bc9c6244e8
Bluetooth: hci_core: fix error handling in hci_register_dev()

[ Upstream commit 0d75da38e060d21f948b3df5f5e349c962cf1ed2 ]

If hci_register_suspend_notifier() returns error, the hdev and rfkill
are leaked. We could disregard the error and print a warning message
instead to avoid leaks, as it just means we won't be handing suspend
requests.

Fixes: 9952d90ea288 ("Bluetooth: Handle PM_SUSPEND_PREPARE and PM_POST_SUSPEND")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/hci_core.c