Lee, Chun-Yi 8d5531
From: Dan Carpenter <dan.carpenter@oracle.com>
Lee, Chun-Yi 8d5531
Date: Wed, 8 Jun 2022 16:46:13 +0300
Lee, Chun-Yi 8d5531
Subject: Bluetooth: fix an error code in hci_register_dev()
Lee, Chun-Yi 8d5531
Patch-mainline: v6.0-rc1
Lee, Chun-Yi 8d5531
Git-commit: 9111786492f13501baf576b772c96bf0e4d5bbcb
Lee, Chun-Yi 8d5531
References: jsc#PED-1407
Lee, Chun-Yi 8d5531
Lee, Chun-Yi 8d5531
Preserve the error code from hci_register_suspend_notifier().  Don't
Lee, Chun-Yi 8d5531
return success.
Lee, Chun-Yi 8d5531
Lee, Chun-Yi 8d5531
Fixes: d6bb2a91f95b ("Bluetooth: Unregister suspend with userchannel")
Lee, Chun-Yi 8d5531
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Lee, Chun-Yi 8d5531
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Lee, Chun-Yi 8d5531
Acked-by: Lee, Chun-Yi <jlee@suse.com>
Lee, Chun-Yi 8d5531
---
Lee, Chun-Yi 8d5531
 net/bluetooth/hci_core.c |    3 ++-
Lee, Chun-Yi 8d5531
 1 file changed, 2 insertions(+), 1 deletion(-)
Lee, Chun-Yi 8d5531
Lee, Chun-Yi 8d5531
--- a/net/bluetooth/hci_core.c
Lee, Chun-Yi 8d5531
+++ b/net/bluetooth/hci_core.c
Lee, Chun-Yi 8d5531
@@ -2647,7 +2647,8 @@ int hci_register_dev(struct hci_dev *hde
Lee, Chun-Yi 8d5531
 	hci_sock_dev_event(hdev, HCI_DEV_REG);
Lee, Chun-Yi 8d5531
 	hci_dev_hold(hdev);
Lee, Chun-Yi 8d5531
 
Lee, Chun-Yi 8d5531
-	if (hci_register_suspend_notifier(hdev))
Lee, Chun-Yi 8d5531
+	error = hci_register_suspend_notifier(hdev);
Lee, Chun-Yi 8d5531
+	if (error)
Lee, Chun-Yi 8d5531
 		goto err_wqueue;
Lee, Chun-Yi 8d5531
 
Lee, Chun-Yi 8d5531
 	queue_work(hdev->req_workqueue, &hdev->power_on);