lkml.org 
[lkml]   [2021]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] Bluetooth: Fix return value in hci_dev_do_close()
Date
hci_error_reset() return without calling hci_dev_do_open() when
hci_dev_do_close() return error value which is not 0.

Also, hci_dev_close() return hci_dev_do_close() function's return
value.

But, hci_dev_do_close() return always 0 even if hdev->shutdown
return error value. So, fix hci_dev_do_close() to save and return
the return value of the hdev->shutdown when it is called.

Signed-off-by: Kangmin Park <l4stpr0gr4m@gmail.com>
---
net/bluetooth/hci_core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b0d9c36acc03..fa5f23df4fc3 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1711,6 +1711,7 @@ static void hci_pend_le_actions_clear(struct hci_dev *hdev)
int hci_dev_do_close(struct hci_dev *hdev)
{
bool auto_off;
+ int ret = 0;

BT_DBG("%s %p", hdev->name, hdev);

@@ -1719,7 +1720,7 @@ int hci_dev_do_close(struct hci_dev *hdev)
test_bit(HCI_UP, &hdev->flags)) {
/* Execute vendor specific shutdown routine */
if (hdev->shutdown)
- hdev->shutdown(hdev);
+ ret = hdev->shutdown(hdev);
}

cancel_delayed_work(&hdev->power_off);
@@ -1730,7 +1731,7 @@ int hci_dev_do_close(struct hci_dev *hdev)
if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
cancel_delayed_work_sync(&hdev->cmd_timer);
hci_req_sync_unlock(hdev);
- return 0;
+ return ret;
}

hci_leds_update_powered(hdev, false);
@@ -1836,7 +1837,7 @@ int hci_dev_do_close(struct hci_dev *hdev)
hci_req_sync_unlock(hdev);

hci_dev_put(hdev);
- return 0;
+ return ret;
}

int hci_dev_close(__u16 dev)
--
2.26.2
\
 
 \ /
  Last update: 2021-08-17 08:30    [W:0.141 / U:0.988 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site