diff mbox series

[BlueZ,v1,1/2] hog-lib: Fix calling bt_uhid_destroy with invalid instance

Message ID 20240819205304.60594-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v1,1/2] hog-lib: Fix calling bt_uhid_destroy with invalid instance | expand

Commit Message

Luiz Augusto von Dentz Aug. 19, 2024, 8:53 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If the hog->uhid cannot be created then it is pointless to call
bt_uhid_destroy as it will likely just produce bogus output as in:

https://github.com/bluez/bluez/issues/529#issuecomment-2297350805
---
 profiles/input/hog-lib.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

bluez.test.bot@gmail.com Aug. 19, 2024, 11:16 p.m. UTC | #1
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=881045

---Test result---

Test Summary:
CheckPatch                    PASS      0.92 seconds
GitLint                       PASS      0.66 seconds
BuildEll                      PASS      25.28 seconds
BluezMake                     PASS      1828.05 seconds
MakeCheck                     FAIL      14.00 seconds
MakeDistcheck                 FAIL      168.85 seconds
CheckValgrind                 FAIL      265.27 seconds
CheckSmatch                   PASS      375.40 seconds
bluezmakeextell               PASS      127.67 seconds
IncrementalBuild              PASS      3199.30 seconds
ScanBuild                     PENDING   1127.18 seconds

Details
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:

make[3]: *** [Makefile:11764: test-suite.log] Error 1
make[2]: *** [Makefile:11872: check-TESTS] Error 2
make[1]: *** [Makefile:12301: check-am] Error 2
make: *** [Makefile:12303: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:

Package cups was not found in the pkg-config search path.
Perhaps you should add the directory containing `cups.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cups' found
make[4]: *** [Makefile:11764: test-suite.log] Error 1
make[3]: *** [Makefile:11872: check-TESTS] Error 2
make[2]: *** [Makefile:12301: check-am] Error 2
make[1]: *** [Makefile:12303: check] Error 2
make: *** [Makefile:12224: distcheck] Error 1
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:

tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12725:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12725 | int main(int argc, char *argv[])
      |     ^~~~
make[3]: *** [Makefile:11764: test-suite.log] Error 1
make[2]: *** [Makefile:11872: check-TESTS] Error 2
make[1]: *** [Makefile:12301: check-am] Error 2
make: *** [Makefile:12303: check] Error 2
##############################
Test: ScanBuild - PENDING
Desc: Run Scan Build
Output:



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c
index 1b4aca07486b..729603702e5f 100644
--- a/profiles/input/hog-lib.c
+++ b/profiles/input/hog-lib.c
@@ -830,14 +830,16 @@  static void uhid_destroy(struct bt_hog *hog, bool force)
 {
 	int err;
 
+	if (!hog->uhid)
+		return;
+
+	bt_uhid_unregister_all(hog->uhid);
+
 	err = bt_uhid_destroy(hog->uhid, force);
 	if (err < 0) {
 		error("bt_uhid_destroy: %s", strerror(-err));
 		return;
 	}
-
-	if (bt_uhid_created(hog->uhid))
-		bt_uhid_unregister_all(hog->uhid);
 }
 
 static void set_report(struct uhid_event *ev, void *user_data)