Diff between 168ea3078066d293e915280bb55ededa7d109abe and 1cc3cf08c4934e3c4dc1413e11ac84ac53ea28cf

Changed Files

File Additions Deletions Status
profiles/input/hog-lib.c +5 -3 modified

Full Patch

diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c
index 1b4aca0..7296037 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)