diff mbox series

[BlueZ,v4,1/2] shared/gatt-db: Add gatt_db_attribute_get_service

Message ID 20221217011059.3087848-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v4,1/2] shared/gatt-db: Add gatt_db_attribute_get_service | expand

Commit Message

Luiz Augusto von Dentz Dec. 17, 2022, 1:10 a.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds gatt_db_attribute_get_service which can be used to get the
service which the given attribute belongs to.
---
 src/shared/gatt-db.c | 9 +++++++++
 src/shared/gatt-db.h | 3 +++
 2 files changed, 12 insertions(+)

Comments

bluez.test.bot@gmail.com Dec. 17, 2022, 3:19 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=705299

---Test result---

Test Summary:
CheckPatch                    PASS      1.17 seconds
GitLint                       PASS      0.52 seconds
BuildEll                      PASS      26.63 seconds
BluezMake                     PASS      740.12 seconds
MakeCheck                     PASS      10.93 seconds
MakeDistcheck                 PASS      145.54 seconds
CheckValgrind                 PASS      237.68 seconds
bluezmakeextell               PASS      93.02 seconds
IncrementalBuild              PASS      1204.05 seconds
ScanBuild                     WARNING   930.96 seconds

Details
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
src/shared/gatt-client.c:387:21: warning: Use of memory after it is freed
        gatt_db_unregister(op->client->db, op->db_id);
                           ^~~~~~~~~~
src/shared/gatt-client.c:632:2: warning: Use of memory after it is freed
        discovery_op_complete(op, false, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:929:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1035:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1227:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1292:2: warning: Use of memory after it is freed
        discovery_op_complete(op, success, att_ecode);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1563:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1568:2: warning: Use of memory after it is freed
        discover_all(op);
        ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2070:6: warning: Use of memory after it is freed
        if (read_db_hash(op)) {
            ^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2078:8: warning: Use of memory after it is freed
                                                        discovery_op_ref(op),
                                                        ^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3161:2: warning: Use of memory after it is freed
        complete_write_long_op(req, success, 0, false);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3183:2: warning: Use of memory after it is freed
        request_unref(req);
        ^~~~~~~~~~~~~~~~~~
12 warnings generated.



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org Dec. 19, 2022, 8:50 p.m. UTC | #2
Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri, 16 Dec 2022 17:10:58 -0800 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This adds gatt_db_attribute_get_service which can be used to get the
> service which the given attribute belongs to.
> ---
>  src/shared/gatt-db.c | 9 +++++++++
>  src/shared/gatt-db.h | 3 +++
>  2 files changed, 12 insertions(+)

Here is the summary with links:
  - [BlueZ,v4,1/2] shared/gatt-db: Add gatt_db_attribute_get_service
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b91d9213d951
  - [BlueZ,v4,2/2] shared/gatt-client: Fix not removing pending services
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=da203f5dbc7e

You are awesome, thank you!
diff mbox series

Patch

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index 9a92090ec493..b696fe33da93 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -1712,6 +1712,15 @@  uint16_t gatt_db_attribute_get_handle(const struct gatt_db_attribute *attrib)
 	return attrib->handle;
 }
 
+struct gatt_db_attribute *
+gatt_db_attribute_get_service(const struct gatt_db_attribute *attrib)
+{
+	if (!attrib)
+		return NULL;
+
+	return attrib->service->attributes[0];
+}
+
 bool gatt_db_attribute_get_service_uuid(const struct gatt_db_attribute *attrib,
 							bt_uuid_t *uuid)
 {
diff --git a/src/shared/gatt-db.h b/src/shared/gatt-db.h
index 41464ad3e7e0..163a981df233 100644
--- a/src/shared/gatt-db.h
+++ b/src/shared/gatt-db.h
@@ -225,6 +225,9 @@  const bt_uuid_t *gatt_db_attribute_get_type(
 
 uint16_t gatt_db_attribute_get_handle(const struct gatt_db_attribute *attrib);
 
+struct gatt_db_attribute *
+gatt_db_attribute_get_service(const struct gatt_db_attribute *attrib);
+
 bool gatt_db_attribute_get_service_uuid(const struct gatt_db_attribute *attrib,
 							bt_uuid_t *uuid);