Skip to contentSkip to conversation

Bluetooth: hci_sync: fix undefined return of hci_disconnect_all_sync()

PATCH Applied [email protected] 3 participants 3 messages Feb 1, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: hci_sync: fix undefined return of hci_disconnect_all_sync()

From: Tom Rix <[email protected]>

clang static analysis reports this problem hci_sync.c:4428:2: warning: Undefined or garbage value
returned to caller

        return err;
        ^~~~~~~~~~

If there are no connections this function is a noop but err is never set and a false error could be reported. Return 0 as other hci_* functions do.

Fixes 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
---
 net/bluetooth/hci_sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_sync.c +1 -1
index 6e71aa6b6feae..9327737da6003 100644
@@ -4425,7 +4425,7 @@ static int hci_disconnect_all_sync(struct hci_dev *hdev, u8 reason)
 			return err;
 	}
 
-	return err;
+	return 0;
 }
 
 /* This function perform power off HCI command sequence as follows:
Signature · 1 line
2.26.3
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=610424

---Test result---

Test Summary:

CheckPatch                    PASS      1.70 seconds
GitLint                       PASS      1.03 seconds
SubjectPrefix                 PASS      0.85 seconds
BuildKernel                   PASS      37.44 seconds
BuildKernel32                 PASS      32.39 seconds
Incremental Build with patchesPASS      44.16 seconds
TestRunner: Setup             PASS      604.98 seconds
TestRunner: l2cap-tester      PASS      16.73 seconds
TestRunner: bnep-tester       PASS      7.82 seconds
TestRunner: mgmt-tester       PASS      129.30 seconds
TestRunner: rfcomm-tester     PASS      9.40 seconds
TestRunner: sco-tester        PASS      9.86 seconds
TestRunner: smp-tester        PASS      9.72 seconds
TestRunner: userchan-tester   PASS      8.10 seconds

---
Regards,
Linux Bluetooth

maintainer Applied
#2 lore raw
In reply to [email protected]

Hi Tom,

Quoted 33 lines · On Tue, Feb 1, 2022 at 9:43 AM <[email protected]> wrote:

From: Tom Rix <[email protected]>

clang static analysis reports this problem hci_sync.c:4428:2: warning: Undefined or garbage value
returned to caller

        return err;
        ^~~~~~~~~~

If there are no connections this function is a noop but err is never set and a false error could be reported. Return 0 as other hci_* functions do.

Fixes 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
---
 net/bluetooth/hci_sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_sync.c +1 -2
index 6e71aa6b6feae..9327737da6003 100644
@@ -4425,7 +4425,7 @@ static int hci_disconnect_all_sync(struct hci_dev *hdev, u8 reason)
                        return err;
        }
 
-       return err;
+       return 0;
 }
 
 /* This function perform power off HCI command sequence as follows:
--
Quoted 1 line

2.26.3

Applied, thanks.

Signature · 1 line
Luiz Augusto von Dentz