diff mbox series

[BlueZ,1/4] shared/gatt-client: Use parent debug_callback if not set on clone

Message ID 20230105220944.2373424-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,1/4] shared/gatt-client: Use parent debug_callback if not set on clone | expand

Commit Message

Luiz Augusto von Dentz Jan. 5, 2023, 10:09 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

If clone don't have a dedicated callback set use its parent so users of
bt_gatt_client_clone don't have to keep setting the same callback for
all clone instances.
---
 src/shared/gatt-client.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

Comments

bluez.test.bot@gmail.com Jan. 6, 2023, 12:03 a.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=709312

---Test result---

Test Summary:
CheckPatch                    PASS      2.39 seconds
GitLint                       PASS      1.39 seconds
BuildEll                      PASS      33.02 seconds
BluezMake                     PASS      998.52 seconds
MakeCheck                     PASS      12.62 seconds
MakeDistcheck                 PASS      178.17 seconds
CheckValgrind                 PASS      289.84 seconds
CheckSmatch                   WARNING   383.95 seconds
bluezmakeextell               PASS      116.46 seconds
IncrementalBuild              PASS      3284.64 seconds
ScanBuild                     WARNING   1193.87 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/gatt-client.c:2764:33: warning: Variable length array is used.src/shared/gatt-client.c:2994:23: warning: Variable length array is used.src/shared/gatt-client.c:3075:23: warning: Variable length array is used.src/shared/gatt-client.c:3514:23: warning: Variable length array is used.src/shared/gatt-client.c:2764:33: warning: Variable length array is used.src/shared/gatt-client.c:2994:23: warning: Variable length array is used.src/shared/gatt-client.c:3075:23: warning: Variable length array is used.src/shared/gatt-client.c:3514:23: warning: Variable length array is used.src/shared/gatt-client.c:2764:33: warning: Variable length array is used.src/shared/gatt-client.c:2994:23: warning: Variable length array is used.src/shared/gatt-client.c:3075:23: warning: Variable length array is used.src/shared/gatt-client.c:3514:23: warning: Variable length array is used.src/shared/gatt-client.c:2764:33: warning: Variable length array is used.src/shared/gatt-client.c:2994:23: warning: Variab
 le length array is used.src/shared/gatt-client.c:3075:23: warning: Variable length array is used.src/shared/gatt-client.c:3514:23: warning: Variable length array is used.src/shared/gatt-client.c:2764:33: warning: Variable length array is used.src/shared/gatt-client.c:2994:23: warning: Variable length array is used.src/shared/gatt-client.c:3075:23: warning: Variable length array is used.src/shared/gatt-client.c:3514:23: warning: Variable length array is used.src/shared/gatt-client.c:2764:33: warning: Variable length array is used.src/shared/gatt-client.c:2994:23: warning: Variable length array is used.src/shared/gatt-client.c:3075:23: warning: Variable length array is used.src/shared/gatt-client.c:3514:23: warning: Variable length array is used.
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
src/shared/gatt-client.c:401:21: warning: Use of memory after it is freed
        gatt_db_unregister(op->client->db, op->db_id);
                           ^~~~~~~~~~
src/shared/gatt-client.c:646:2: warning: Use of memory after it is freed
        discovery_op_complete(op, false, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:943:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1049:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1241:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1306:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1577:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1582:2: warning: Use of memory after it is freed
        discover_all(op);
        ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2088:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2096:8: warning: Use of memory after it is freed
                                                        discovery_op_ref(op),
                                                        ^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3182:2: warning: Use of memory after it is freed
        complete_write_long_op(req, success, 0, false);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3204:2: warning: Use of memory after it is freed
        request_unref(req);
        ^~~~~~~~~~~~~~~~~~
12 warnings generated.



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index cb2e64b6cc6b..4aa5d7d92957 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -38,7 +38,8 @@ 
 #define GATT_SVC_UUID	0x1801
 #define SVC_CHNGD_UUID	0x2a05
 #define DBG(_client, _format, arg...) \
-	gatt_log(_client, "%s:%s() " _format, __FILE__, __func__, ## arg)
+	gatt_log(_client, "[%p] %s:%s() " _format, _client, __FILE__, \
+		__func__, ## arg)
 
 struct ready_cb {
 	bt_gatt_client_callback_t callback;
@@ -357,15 +358,28 @@  static void discovery_op_free(struct discovery_op *op)
 
 static bool read_db_hash(struct discovery_op *op);
 
+static void gatt_log_va(struct bt_gatt_client *client, const char *format,
+						va_list va)
+{
+	if (!client || !format)
+		return;
+
+	if (client->debug_callback)
+		util_debug_va(client->debug_callback, client->debug_data,
+							format, va);
+	else
+		gatt_log_va(client->parent, format, va);
+}
+
 static void gatt_log(struct bt_gatt_client *client, const char *format, ...)
 {
 	va_list ap;
 
-	if (!client || !format || !client->debug_callback)
+	if (!client || !format)
 		return;
 
 	va_start(ap, format);
-	util_debug_va(client->debug_callback, client->debug_data, format, ap);
+	gatt_log_va(client, format, ap);
 	va_end(ap);
 }