* [PATCH bluez v3 0/2] audio: Don't initialize media transport volume from media player
@ 2025-08-06 1:07 Myrrh Periwinkle
2025-08-06 1:07 ` [PATCH bluez v3 1/2] " Myrrh Periwinkle
2025-08-06 1:07 ` [PATCH bluez v3 2/2] audio: Remove media_player.volume Myrrh Periwinkle
0 siblings, 2 replies; 6+ messages in thread
From: Myrrh Periwinkle @ 2025-08-06 1:07 UTC (permalink / raw)
To: Linux Bluetooth; +Cc: Myrrh Periwinkle, Luiz Augusto von Dentz
Fixes an issue where if a Bluetooth headphone with hardware volume
control was connected while mpris-proxy was running, disconnected and
replaced with a different one without hardware volume control, the
latter will be erroneously recognized as hardware volume
control capable.
---
Changes in v3:
- Actually remove the correct field
- Link to v2: https://patch.msgid.link/20250806-audio-no-reuse-media-player-volume-v2-0-cfeafb7dee0c@qtmlabs.xyz
Changes in v2:
- Remove media_player.volume
- Link to v1: https://patch.msgid.link/20250805-audio-no-reuse-media-player-volume-v1-1-c9fdfaf74a71@qtmlabs.xyz
---
Myrrh Periwinkle (2):
audio: Don't initialize media transport volume from media player
audio: Remove media_player.volume
profiles/audio/avrcp.c | 8 +-------
profiles/audio/avrcp.h | 2 --
profiles/audio/media.c | 47 +----------------------------------------------
profiles/audio/media.h | 1 -
4 files changed, 2 insertions(+), 56 deletions(-)
---
base-commit: 2c0c323d08357a4ff3065fcd49fee0c83b5835cd
change-id: 20250805-audio-no-reuse-media-player-volume-fbc2983a287a
Best regards,
--
Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH bluez v3 1/2] audio: Don't initialize media transport volume from media player 2025-08-06 1:07 [PATCH bluez v3 0/2] audio: Don't initialize media transport volume from media player Myrrh Periwinkle @ 2025-08-06 1:07 ` Myrrh Periwinkle 2025-08-06 2:19 ` bluez.test.bot 2025-08-06 1:07 ` [PATCH bluez v3 2/2] audio: Remove media_player.volume Myrrh Periwinkle 1 sibling, 1 reply; 6+ messages in thread From: Myrrh Periwinkle @ 2025-08-06 1:07 UTC (permalink / raw) To: Linux Bluetooth; +Cc: Myrrh Periwinkle, Luiz Augusto von Dentz Media player objects may be shared between devices. As a result, a device without support for hardware volume that is connected after one that does may end up being erroneously considered hardware volume-capable. fa7828bdd ("transport: Fix not being able to initialize volume properly") introduced btd_device_{get,set}_volume that is used as an alternative in case no media player objects are present. Therefore, we can remove media_player_get_device_volume and instead use btd_device_get_volume to determine the initial volume. --- profiles/audio/avrcp.c | 2 +- profiles/audio/media.c | 33 +-------------------------------- profiles/audio/media.h | 1 - 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index e2797112fcd580c3fc56793f933e00b1c61e5205..ec07522e6a34eb1dc5f6f413f48f1087a609df9a 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -4284,7 +4284,7 @@ static void target_init(struct avrcp *session) target->player = player; player->sessions = g_slist_prepend(player->sessions, session); - init_volume = media_player_get_device_volume(session->dev); + init_volume = btd_device_get_volume(session->dev); media_transport_update_device_volume(session->dev, init_volume); } diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 8e62dca17070edbc5101677c6eebd3707492c824..55f1482d1d9ce52e104481bab3ede373f47aee0c 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -499,37 +499,6 @@ struct a2dp_config_data { a2dp_endpoint_config_t cb; }; -int8_t media_player_get_device_volume(struct btd_device *device) -{ -#ifdef HAVE_AVRCP - struct avrcp_player *target_player; - struct media_adapter *adapter; - GSList *l; - - if (!device) - return -1; - - target_player = avrcp_get_target_player_by_device(device); - if (!target_player) - goto done; - - adapter = find_adapter(device); - if (!adapter) - goto done; - - for (l = adapter->players; l; l = l->next) { - struct media_player *mp = l->data; - - if (mp->player == target_player) - return mp->volume; - } - -done: -#endif /* HAVE_AVRCP */ - /* If media_player doesn't exists use device_volume */ - return btd_device_get_volume(device); -} - static gboolean set_configuration(struct media_endpoint *endpoint, uint8_t *configuration, size_t size, media_endpoint_cb_t cb, @@ -556,7 +525,7 @@ static gboolean set_configuration(struct media_endpoint *endpoint, if (transport == NULL) return FALSE; - init_volume = media_player_get_device_volume(device); + init_volume = btd_device_get_volume(device); media_transport_update_volume(transport, init_volume); msg = dbus_message_new_method_call(endpoint->sender, endpoint->path, diff --git a/profiles/audio/media.h b/profiles/audio/media.h index 2b2e8e1572874d5f71abb28fdd5b92fa2d9efe83..d3954abd6de505a69cab3fcffc217d236a52d3e5 100644 --- a/profiles/audio/media.h +++ b/profiles/audio/media.h @@ -23,6 +23,5 @@ uint8_t media_endpoint_get_codec(struct media_endpoint *endpoint); struct btd_adapter *media_endpoint_get_btd_adapter( struct media_endpoint *endpoint); bool media_endpoint_is_broadcast(struct media_endpoint *endpoint); -int8_t media_player_get_device_volume(struct btd_device *device); const struct media_endpoint *media_endpoint_get_asha(void); -- 2.50.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: audio: Don't initialize media transport volume from media player 2025-08-06 1:07 ` [PATCH bluez v3 1/2] " Myrrh Periwinkle @ 2025-08-06 2:19 ` bluez.test.bot 0 siblings, 0 replies; 6+ messages in thread From: bluez.test.bot @ 2025-08-06 2:19 UTC (permalink / raw) To: linux-bluetooth, myrrhperiwinkle [-- Attachment #1: Type: text/plain, Size: 33991 bytes --] 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=988588 ---Test result--- Test Summary: CheckPatch PENDING 0.30 seconds GitLint PENDING 0.33 seconds BuildEll PASS 20.42 seconds BluezMake FAIL 2681.73 seconds MakeCheck FAIL 188.03 seconds MakeDistcheck PASS 187.03 seconds CheckValgrind FAIL 113.63 seconds CheckSmatch FAIL 187.43 seconds bluezmakeextell FAIL 99.01 seconds IncrementalBuild PENDING 0.22 seconds ScanBuild FAIL 211.30 seconds Details ############################## Test: CheckPatch - PENDING Desc: Run checkpatch.pl script Output: ############################## Test: GitLint - PENDING Desc: Run gitlint Output: ############################## Test: BluezMake - FAIL Desc: Build BlueZ Output: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12907:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12907 | int main(int argc, char *argv[]) | ^~~~ unit/test-avdtp.c: In function ‘main’: unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 766 | int main(int argc, char *argv[]) | ^~~~ unit/test-avrcp.c: In function ‘main’: unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 989 | int main(int argc, char *argv[]) | ^~~~ profiles/audio/avrcp.c: In function ‘avrcp_volume_changed’: profiles/audio/avrcp.c:3799:23: error: unused variable ‘player’ [-Werror=unused-variable] 3799 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ profiles/audio/avrcp.c: In function ‘avrcp_handle_set_volume’: profiles/audio/avrcp.c:4637:23: error: unused variable ‘player’ [-Werror=unused-variable] 4637 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:8427: profiles/audio/bluetoothd-avrcp.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4033: all] Error 2 ############################## Test: MakeCheck - FAIL Desc: Run Bluez Make Check Output: profiles/audio/avrcp.c: In function ‘avrcp_volume_changed’: profiles/audio/avrcp.c:3799:23: error: unused variable ‘player’ [-Werror=unused-variable] 3799 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ profiles/audio/avrcp.c: In function ‘avrcp_handle_set_volume’: profiles/audio/avrcp.c:4637:23: error: unused variable ‘player’ [-Werror=unused-variable] 4637 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:8427: profiles/audio/bluetoothd-avrcp.o] Error 1 make: *** [Makefile:10455: check] Error 2 ############################## Test: CheckValgrind - FAIL Desc: Run Bluez Make Check with Valgrind Output: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12907:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12907 | int main(int argc, char *argv[]) | ^~~~ profiles/audio/avrcp.c: In function ‘avrcp_volume_changed’: profiles/audio/avrcp.c:3799:23: error: unused variable ‘player’ [-Werror=unused-variable] 3799 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ profiles/audio/avrcp.c: In function ‘avrcp_handle_set_volume’: profiles/audio/avrcp.c:4637:23: error: unused variable ‘player’ [-Werror=unused-variable] 4637 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:8427: profiles/audio/bluetoothd-avrcp.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:10455: check] Error 2 ############################## Test: CheckSmatch - FAIL Desc: Run smatch tool with source Output: src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:317:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:317:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%' tools/sco-tester.c: note: in included file: ./lib/bluetooth.h:232:15: warning: array of flexible structures ./lib/bluetooth.h:237:31: warning: array of flexible structures tools/bneptest.c:634:39: warning: unknown escape sequence: '\%' tools/seq2bseq.c:57:26: warning: Variable length array is used. tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' unit/avctp.c:505:34: warning: Variable length array is used. unit/avctp.c:556:34: warning: Variable length array is used. unit/test-avrcp.c:373:26: warning: Variable length array is used. unit/test-avrcp.c:398:26: warning: Variable length array is used. unit/test-avrcp.c:414:24: warning: Variable length array is used. unit/avrcp-lib.c:1085:34: warning: Variable length array is used. unit/avrcp-lib.c:1583:34: warning: Variable length array is used. unit/avrcp-lib.c:1612:34: warning: Variable length array is used. unit/avrcp-lib.c:1638:34: warning: Variable length array is used. profiles/audio/avrcp.c: In function ‘avrcp_volume_changed’: profiles/audio/avrcp.c:3799:23: error: unused variable ‘player’ [-Werror=unused-variable] 3799 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ profiles/audio/avrcp.c: In function ‘avrcp_handle_set_volume’: profiles/audio/avrcp.c:4637:23: error: unused variable ‘player’ [-Werror=unused-variable] 4637 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:8427: profiles/audio/bluetoothd-avrcp.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4033: all] Error 2 ############################## Test: bluezmakeextell - FAIL Desc: Build Bluez with External ELL Output: profiles/audio/avrcp.c: In function ‘avrcp_volume_changed’: profiles/audio/avrcp.c:3799:23: error: unused variable ‘player’ [-Werror=unused-variable] 3799 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ profiles/audio/avrcp.c: In function ‘avrcp_handle_set_volume’: profiles/audio/avrcp.c:4637:23: error: unused variable ‘player’ [-Werror=unused-variable] 4637 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:8427: profiles/audio/bluetoothd-avrcp.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4033: all] Error 2 ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: ############################## Test: ScanBuild - FAIL Desc: Run Scan Build Output: src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed gatt_db_unregister(op->client->db, op->db_id); ^~~~~~~~~~ src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed discovery_op_complete(op, false, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1296:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1361:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1636:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1641:2: warning: Use of memory after it is freed discover_all(op); ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2147:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2155:8: warning: Use of memory after it is freed discovery_op_ref(op), ^~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3180:2: warning: Use of memory after it is freed complete_write_long_op(req, success, 0, false); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3202:2: warning: Use of memory after it is freed request_unref(req); ^~~~~~~~~~~~~~~~~~ 12 warnings generated. src/shared/bap.c:1528:8: warning: Use of memory after it is freed bap = bt_bap_ref_safe(bap); ^~~~~~~~~~~~~~~~~~~~ src/shared/bap.c:2310:20: warning: Use of memory after it is freed return queue_find(stream->bap->streams, NULL, stream); ^~~~~~~~~~~~~~~~~~~~ 2 warnings generated. src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed gatt_db_unregister(op->client->db, op->db_id); ^~~~~~~~~~ src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed discovery_op_complete(op, false, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1296:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1361:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1636:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1641:2: warning: Use of memory after it is freed discover_all(op); ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2147:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2155:8: warning: Use of memory after it is freed discovery_op_ref(op), ^~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3180:2: warning: Use of memory after it is freed complete_write_long_op(req, success, 0, false); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3202:2: warning: Use of memory after it is freed request_unref(req); ^~~~~~~~~~~~~~~~~~ 12 warnings generated. tools/hciattach.c:817:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 10)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:865:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:887:8: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 10)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:909:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:930:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:974:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 6)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 warnings generated. src/shared/bap.c:1528:8: warning: Use of memory after it is freed bap = bt_bap_ref_safe(bap); ^~~~~~~~~~~~~~~~~~~~ src/shared/bap.c:2310:20: warning: Use of memory after it is freed return queue_find(stream->bap->streams, NULL, stream); ^~~~~~~~~~~~~~~~~~~~ 2 warnings generated. src/oui.c:50:2: warning: Value stored to 'hwdb' is never read hwdb = udev_hwdb_unref(hwdb); ^ ~~~~~~~~~~~~~~~~~~~~~ src/oui.c:53:2: warning: Value stored to 'udev' is never read udev = udev_unref(udev); ^ ~~~~~~~~~~~~~~~~ 2 warnings generated. tools/rfcomm.c:234:3: warning: Value stored to 'i' is never read i = execvp(cmdargv[0], cmdargv); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:234:7: warning: Null pointer passed to 1st parameter expecting 'nonnull' i = execvp(cmdargv[0], cmdargv); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:354:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd' if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:497:14: warning: Assigned value is garbage or undefined req.channel = raddr.rc_channel; ^ ~~~~~~~~~~~~~~~~ tools/rfcomm.c:515:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd' if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 warnings generated. tools/hcidump.c:180:9: warning: Potential leak of memory pointed to by 'dp' if (fds[i].fd == sock) ^~~ tools/hcidump.c:248:17: warning: Assigned value is garbage or undefined dh->ts_sec = htobl(frm.ts.tv_sec); ^ ~~~~~~~~~~~~~~~~~~~~ tools/hcidump.c:326:9: warning: 1st function call argument is an uninitialized value if (be32toh(dp.flags) & 0x02) { ^~~~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:341:20: warning: 1st function call argument is an uninitialized value frm.data_len = be32toh(dp.len); ^~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:346:14: warning: 1st function call argument is an uninitialized value opcode = be32toh(dp.flags) & 0xffff; ^~~~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:384:17: warning: Assigned value is garbage or undefined frm.data_len = btohs(dh.len); ^ ~~~~~~~~~~~~~ tools/hcidump.c:394:11: warning: Assigned value is garbage or undefined frm.len = frm.data_len; ^ ~~~~~~~~~~~~ tools/hcidump.c:398:9: warning: 1st function call argument is an uninitialized value ts = be64toh(ph.ts); ^~~~~~~~~~~~~~ /usr/include/endian.h:51:22: note: expanded from macro 'be64toh' # define be64toh(x) __bswap_64 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:403:13: warning: 1st function call argument is an uninitialized value frm.in = be32toh(dp.flags) & 0x01; ^~~~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:408:11: warning: Assigned value is garbage or undefined frm.in = dh.in; ^ ~~~~~ tools/hcidump.c:437:7: warning: Null pointer passed to 1st parameter expecting 'nonnull' fd = open(file, open_flags, 0644); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11 warnings generated. tools/ciptool.c:351:7: warning: 5th function call argument is an uninitialized value sk = do_connect(ctl, dev_id, &src, &dst, psm, (1 << CMTP_LOOPBACK)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. src/sdp-xml.c:126:10: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:300:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:338:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ 3 warnings generated. tools/sdptool.c:941:26: warning: Result of 'malloc' is converted to a pointer of type 'uint32_t', which is incompatible with sizeof operand type 'int' uint32_t *value_int = malloc(sizeof(int)); ~~~~~~~~~~ ^~~~~~ ~~~~~~~~~~~ tools/sdptool.c:980:4: warning: 1st function call argument is an uninitialized value free(allocArray[i]); ^~~~~~~~~~~~~~~~~~~ tools/sdptool.c:3777:2: warning: Potential leak of memory pointed to by 'si.name' return add_service(0, &si); ^~~~~~~~~~~~~~~~~~~~~~~~~~ tools/sdptool.c:4112:4: warning: Potential leak of memory pointed to by 'context.svc' return -1; ^~~~~~~~~ 4 warnings generated. tools/avtest.c:243:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:253:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:262:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:276:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:283:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:290:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:297:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:309:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:313:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:322:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:326:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:335:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:342:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:364:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:368:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:377:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:381:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:394:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:398:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:405:4: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:415:4: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:580:3: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:588:3: warning: Value stored to 'len' is never read len = write(sk, buf, invalid ? 2 : 3); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/avtest.c:602:3: warning: Value stored to 'len' is never read len = write(sk, buf, 4 + media_transport_size); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/avtest.c:615:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:625:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:637:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:652:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:664:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:673:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:680:3: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:716:2: warning: Value stored to 'len' is never read len = write(sk, buf, AVCTP_HEADER_LENGTH + sizeof(play_pressed)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 warnings generated. tools/btproxy.c:836:15: warning: Null pointer passed to 1st parameter expecting 'nonnull' tcp_port = atoi(optarg); ^~~~~~~~~~~~ tools/btproxy.c:839:8: warning: Null pointer passed to 1st parameter expecting 'nonnull' if (strlen(optarg) > 3 && !strncmp(optarg, "hci", 3)) ^~~~~~~~~~~~~~ 2 warnings generated. tools/iso-tester.c:1899:7: warning: Potential leak of memory pointed to by 'addr' err = bind(sk, (struct sockaddr *) addr, sizeof(*addr) + ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/iso-tester.c:1907:7: warning: Potential leak of memory pointed to by 'addr' err = bind(sk, (struct sockaddr *) addr, sizeof(*addr)); ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. tools/create-image.c:76:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:84:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:92:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:105:2: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ 4 warnings generated. tools/check-selftest.c:42:3: warning: Value stored to 'ptr' is never read ptr = fgets(result, sizeof(result), fp); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. tools/gatt-service.c:294:2: warning: 2nd function call argument is an uninitialized value chr_write(chr, value, len); ^~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. tools/btgatt-server.c:1212:2: warning: Value stored to 'argv' is never read argv -= optind; ^ ~~~~~~ 1 warning generated. tools/btgatt-client.c:1824:2: warning: Value stored to 'argv' is never read argv += optind; ^ ~~~~~~ 1 warning generated. tools/obex-server-tool.c:133:13: warning: Null pointer passed to 1st parameter expecting 'nonnull' data->fd = open(name, O_WRONLY | O_CREAT | O_NOCTTY, 0600); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/obex-server-tool.c:192:13: warning: Null pointer passed to 1st parameter expecting 'nonnull' data->fd = open(name, O_RDONLY | O_NOCTTY, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. tools/btpclientctl.c:402:3: warning: Value stored to 'bit' is never read bit = 0; ^ ~ tools/btpclientctl.c:1655:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull' memcpy(cp->data, ad_data, ad_len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. src/sdpd-request.c:211:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint16_t' pElem = malloc(sizeof(uint16_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ src/sdpd-request.c:239:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint32_t' pElem = malloc(sizeof(uint32_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ 2 warnings generated. unit/avrcp-lib.c:1968:3: warning: 1st function call argument is an uninitialized value g_free(text[i]); ^~~~~~~~~~~~~~~ 1 warning generated. unit/avdtp.c:756:25: warning: Use of memory after it is freed session->prio_queue = g_slist_remove(session->prio_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ unit/avdtp.c:763:24: warning: Use of memory after it is freed session->req_queue = g_slist_remove(session->req_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. profiles/audio/avdtp.c:893:25: warning: Use of memory after it is freed session->prio_queue = g_slist_remove(session->prio_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ profiles/audio/avdtp.c:900:24: warning: Use of memory after it is freed session->req_queue = g_slist_remove(session->req_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. profiles/audio/avrcp.c: In function ‘avrcp_volume_changed’: profiles/audio/avrcp.c:3799:23: error: unused variable ‘player’ [-Werror=unused-variable] 3799 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ profiles/audio/avrcp.c: In function ‘avrcp_handle_set_volume’: profiles/audio/avrcp.c:4637:23: error: unused variable ‘player’ [-Werror=unused-variable] 4637 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:8427: profiles/audio/bluetoothd-avrcp.o] Error 1 make[1]: *** Waiting for unfinished jobs.... profiles/audio/a2dp.c:375:8: warning: Use of memory after it is freed if (!cb->resume_cb) ^~~~~~~~~~~~~ profiles/audio/a2dp.c:3283:20: warning: Access to field 'starting' results in a dereference of a null pointer (loaded from variable 'stream') stream->starting = TRUE; ~~~~~~ ^ profiles/audio/a2dp.c:3286:8: warning: Access to field 'suspending' results in a dereference of a null pointer (loaded from variable 'stream') if (!stream->suspending && stream->suspend_timer) { ^~~~~~~~~~~~~~~~~~ profiles/audio/a2dp.c:3346:22: warning: Access to field 'suspending' results in a dereference of a null pointer (loaded from variable 'stream') stream->suspending = TRUE; ~~~~~~ ^ 4 warnings generated. make: *** [Makefile:4033: all] Error 2 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH bluez v3 2/2] audio: Remove media_player.volume 2025-08-06 1:07 [PATCH bluez v3 0/2] audio: Don't initialize media transport volume from media player Myrrh Periwinkle 2025-08-06 1:07 ` [PATCH bluez v3 1/2] " Myrrh Periwinkle @ 2025-08-06 1:07 ` Myrrh Periwinkle 1 sibling, 0 replies; 6+ messages in thread From: Myrrh Periwinkle @ 2025-08-06 1:07 UTC (permalink / raw) To: Linux Bluetooth; +Cc: Myrrh Periwinkle, Luiz Augusto von Dentz With the previous commit, the media_player.volume field is now completely unused. As this was never the right place to store the initial volume to begin with, remove this field entirely as well as its associated supporting methods to prevent confusion. --- profiles/audio/avrcp.c | 6 ------ profiles/audio/avrcp.h | 2 -- profiles/audio/media.c | 14 -------------- 3 files changed, 22 deletions(-) diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c index ec07522e6a34eb1dc5f6f413f48f1087a609df9a..5087da4c2c90f76fc92d95152e50c7dddd0a8b11 100644 --- a/profiles/audio/avrcp.c +++ b/profiles/audio/avrcp.c @@ -3808,9 +3808,6 @@ static void avrcp_volume_changed(struct avrcp *session, /* Always attempt to update the transport volume */ media_transport_update_device_volume(session->dev, volume); - - if (player) - player->cb->set_volume(volume, session->dev, player->user_data); } static void avrcp_status_changed(struct avrcp *session, @@ -4650,9 +4647,6 @@ static gboolean avrcp_handle_set_volume(struct avctp *conn, uint8_t code, /* Always attempt to update the transport volume */ media_transport_update_device_volume(session->dev, volume); - if (player != NULL) - player->cb->set_volume(volume, session->dev, player->user_data); - return FALSE; } diff --git a/profiles/audio/avrcp.h b/profiles/audio/avrcp.h index 887753ddf28643800fabbddb1bf0941ed3930463..1f46df17d48e7c1d22ccf97bc7804e21372f5882 100644 --- a/profiles/audio/avrcp.h +++ b/profiles/audio/avrcp.h @@ -83,8 +83,6 @@ struct avrcp_player_cb { uint32_t (*get_position)(void *user_data); uint32_t (*get_duration)(void *user_data); const char *(*get_name)(void *user_data); - void (*set_volume)(int8_t volume, struct btd_device *dev, - void *user_data); bool (*play)(void *user_data); bool (*stop)(void *user_data); bool (*pause)(void *user_data); diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 55f1482d1d9ce52e104481bab3ede373f47aee0c..fd6e30f042ecee9882694059fcf72daf5e0eb436 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -142,7 +142,6 @@ struct media_player { char *status; uint32_t position; uint32_t duration; - int8_t volume; GTimer *timer; bool play; bool pause; @@ -2036,17 +2035,6 @@ static uint32_t media_player_get_duration(void *user_data) return mp->duration; } -static void media_player_set_volume(int8_t volume, struct btd_device *dev, - void *user_data) -{ - struct media_player *mp = user_data; - - if (mp->volume == volume) - return; - - mp->volume = volume; -} - static bool media_player_send(struct media_player *mp, const char *name) { DBusMessage *msg; @@ -2134,7 +2122,6 @@ static struct avrcp_player_cb player_cb = { .get_duration = media_player_get_duration, .get_status = media_player_get_status, .get_name = media_player_get_player_name, - .set_volume = media_player_set_volume, .play = media_player_play, .stop = media_player_stop, .pause = media_player_pause, @@ -2617,7 +2604,6 @@ static struct media_player *media_player_create(struct media_adapter *adapter, mp->sender = g_strdup(sender); mp->path = g_strdup(path); mp->timer = g_timer_new(); - mp->volume = -1; mp->watch = g_dbus_add_disconnect_watch(conn, sender, media_player_exit, mp, -- 2.50.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH bluez v4 1/2] audio: Don't initialize media transport volume from media player
@ 2025-08-06 2:22 Myrrh Periwinkle
2025-08-06 4:32 ` bluez.test.bot
0 siblings, 1 reply; 6+ messages in thread
From: Myrrh Periwinkle @ 2025-08-06 2:22 UTC (permalink / raw)
To: Linux Bluetooth; +Cc: Myrrh Periwinkle, Luiz Augusto von Dentz
Media player objects may be shared between devices. As a result,
a device without support for hardware volume that is connected after one
that does may end up being erroneously considered hardware
volume-capable.
fa7828bdd ("transport: Fix not being able to initialize volume properly")
introduced btd_device_{get,set}_volume that is used as an alternative in
case no media player objects are present. Therefore, we can remove
media_player_get_device_volume and instead use btd_device_get_volume to
determine the initial volume.
---
profiles/audio/avrcp.c | 2 +-
profiles/audio/media.c | 33 +--------------------------------
profiles/audio/media.h | 1 -
3 files changed, 2 insertions(+), 34 deletions(-)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index e2797112fcd580c3fc56793f933e00b1c61e5205..ec07522e6a34eb1dc5f6f413f48f1087a609df9a 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -4284,7 +4284,7 @@ static void target_init(struct avrcp *session)
target->player = player;
player->sessions = g_slist_prepend(player->sessions, session);
- init_volume = media_player_get_device_volume(session->dev);
+ init_volume = btd_device_get_volume(session->dev);
media_transport_update_device_volume(session->dev, init_volume);
}
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 8e62dca17070edbc5101677c6eebd3707492c824..55f1482d1d9ce52e104481bab3ede373f47aee0c 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -499,37 +499,6 @@ struct a2dp_config_data {
a2dp_endpoint_config_t cb;
};
-int8_t media_player_get_device_volume(struct btd_device *device)
-{
-#ifdef HAVE_AVRCP
- struct avrcp_player *target_player;
- struct media_adapter *adapter;
- GSList *l;
-
- if (!device)
- return -1;
-
- target_player = avrcp_get_target_player_by_device(device);
- if (!target_player)
- goto done;
-
- adapter = find_adapter(device);
- if (!adapter)
- goto done;
-
- for (l = adapter->players; l; l = l->next) {
- struct media_player *mp = l->data;
-
- if (mp->player == target_player)
- return mp->volume;
- }
-
-done:
-#endif /* HAVE_AVRCP */
- /* If media_player doesn't exists use device_volume */
- return btd_device_get_volume(device);
-}
-
static gboolean set_configuration(struct media_endpoint *endpoint,
uint8_t *configuration, size_t size,
media_endpoint_cb_t cb,
@@ -556,7 +525,7 @@ static gboolean set_configuration(struct media_endpoint *endpoint,
if (transport == NULL)
return FALSE;
- init_volume = media_player_get_device_volume(device);
+ init_volume = btd_device_get_volume(device);
media_transport_update_volume(transport, init_volume);
msg = dbus_message_new_method_call(endpoint->sender, endpoint->path,
diff --git a/profiles/audio/media.h b/profiles/audio/media.h
index 2b2e8e1572874d5f71abb28fdd5b92fa2d9efe83..d3954abd6de505a69cab3fcffc217d236a52d3e5 100644
--- a/profiles/audio/media.h
+++ b/profiles/audio/media.h
@@ -23,6 +23,5 @@ uint8_t media_endpoint_get_codec(struct media_endpoint *endpoint);
struct btd_adapter *media_endpoint_get_btd_adapter(
struct media_endpoint *endpoint);
bool media_endpoint_is_broadcast(struct media_endpoint *endpoint);
-int8_t media_player_get_device_volume(struct btd_device *device);
const struct media_endpoint *media_endpoint_get_asha(void);
--
2.50.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* RE: audio: Don't initialize media transport volume from media player 2025-08-06 2:22 [PATCH bluez v4 1/2] audio: Don't initialize media transport volume from media player Myrrh Periwinkle @ 2025-08-06 4:32 ` bluez.test.bot 0 siblings, 0 replies; 6+ messages in thread From: bluez.test.bot @ 2025-08-06 4:32 UTC (permalink / raw) To: linux-bluetooth, myrrhperiwinkle [-- Attachment #1: Type: text/plain, Size: 1261 bytes --] 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=988599 ---Test result--- Test Summary: CheckPatch PENDING 0.27 seconds GitLint PENDING 0.20 seconds BuildEll PASS 20.13 seconds BluezMake PASS 2721.55 seconds MakeCheck PASS 19.95 seconds MakeDistcheck PASS 184.17 seconds CheckValgrind PASS 233.69 seconds CheckSmatch PASS 306.56 seconds bluezmakeextell PASS 127.79 seconds IncrementalBuild PENDING 0.29 seconds ScanBuild PASS 919.18 seconds Details ############################## Test: CheckPatch - PENDING Desc: Run checkpatch.pl script Output: ############################## Test: GitLint - PENDING Desc: Run gitlint Output: ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH bluez v2 1/2] audio: Don't initialize media transport volume from media player
@ 2025-08-06 1:04 Myrrh Periwinkle
2025-08-06 2:18 ` bluez.test.bot
0 siblings, 1 reply; 6+ messages in thread
From: Myrrh Periwinkle @ 2025-08-06 1:04 UTC (permalink / raw)
To: Linux Bluetooth; +Cc: Myrrh Periwinkle, Luiz Augusto von Dentz
Media player objects may be shared between devices. As a result,
a device without support for hardware volume that is connected after one
that does may end up being erroneously considered hardware
volume-capable.
fa7828bdd ("transport: Fix not being able to initialize volume properly")
introduced btd_device_{get,set}_volume that is used as an alternative in
case no media player objects are present. Therefore, we can remove
media_player_get_device_volume and instead use btd_device_get_volume to
determine the initial volume.
---
profiles/audio/avrcp.c | 2 +-
profiles/audio/media.c | 33 +--------------------------------
profiles/audio/media.h | 1 -
3 files changed, 2 insertions(+), 34 deletions(-)
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index e2797112fcd580c3fc56793f933e00b1c61e5205..ec07522e6a34eb1dc5f6f413f48f1087a609df9a 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -4284,7 +4284,7 @@ static void target_init(struct avrcp *session)
target->player = player;
player->sessions = g_slist_prepend(player->sessions, session);
- init_volume = media_player_get_device_volume(session->dev);
+ init_volume = btd_device_get_volume(session->dev);
media_transport_update_device_volume(session->dev, init_volume);
}
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 8e62dca17070edbc5101677c6eebd3707492c824..55f1482d1d9ce52e104481bab3ede373f47aee0c 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -499,37 +499,6 @@ struct a2dp_config_data {
a2dp_endpoint_config_t cb;
};
-int8_t media_player_get_device_volume(struct btd_device *device)
-{
-#ifdef HAVE_AVRCP
- struct avrcp_player *target_player;
- struct media_adapter *adapter;
- GSList *l;
-
- if (!device)
- return -1;
-
- target_player = avrcp_get_target_player_by_device(device);
- if (!target_player)
- goto done;
-
- adapter = find_adapter(device);
- if (!adapter)
- goto done;
-
- for (l = adapter->players; l; l = l->next) {
- struct media_player *mp = l->data;
-
- if (mp->player == target_player)
- return mp->volume;
- }
-
-done:
-#endif /* HAVE_AVRCP */
- /* If media_player doesn't exists use device_volume */
- return btd_device_get_volume(device);
-}
-
static gboolean set_configuration(struct media_endpoint *endpoint,
uint8_t *configuration, size_t size,
media_endpoint_cb_t cb,
@@ -556,7 +525,7 @@ static gboolean set_configuration(struct media_endpoint *endpoint,
if (transport == NULL)
return FALSE;
- init_volume = media_player_get_device_volume(device);
+ init_volume = btd_device_get_volume(device);
media_transport_update_volume(transport, init_volume);
msg = dbus_message_new_method_call(endpoint->sender, endpoint->path,
diff --git a/profiles/audio/media.h b/profiles/audio/media.h
index 2b2e8e1572874d5f71abb28fdd5b92fa2d9efe83..d3954abd6de505a69cab3fcffc217d236a52d3e5 100644
--- a/profiles/audio/media.h
+++ b/profiles/audio/media.h
@@ -23,6 +23,5 @@ uint8_t media_endpoint_get_codec(struct media_endpoint *endpoint);
struct btd_adapter *media_endpoint_get_btd_adapter(
struct media_endpoint *endpoint);
bool media_endpoint_is_broadcast(struct media_endpoint *endpoint);
-int8_t media_player_get_device_volume(struct btd_device *device);
const struct media_endpoint *media_endpoint_get_asha(void);
--
2.50.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* RE: audio: Don't initialize media transport volume from media player 2025-08-06 1:04 [PATCH bluez v2 1/2] " Myrrh Periwinkle @ 2025-08-06 2:18 ` bluez.test.bot 0 siblings, 0 replies; 6+ messages in thread From: bluez.test.bot @ 2025-08-06 2:18 UTC (permalink / raw) To: linux-bluetooth, myrrhperiwinkle [-- Attachment #1: Type: text/plain, Size: 35626 bytes --] 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=988586 ---Test result--- Test Summary: CheckPatch PENDING 0.27 seconds GitLint PENDING 0.27 seconds BuildEll PASS 20.24 seconds BluezMake FAIL 2787.56 seconds MakeCheck FAIL 178.82 seconds MakeDistcheck FAIL 77.18 seconds CheckValgrind FAIL 112.67 seconds CheckSmatch FAIL 183.46 seconds bluezmakeextell FAIL 97.24 seconds IncrementalBuild PENDING 0.27 seconds ScanBuild FAIL 206.70 seconds Details ############################## Test: CheckPatch - PENDING Desc: Run checkpatch.pl script Output: ############################## Test: GitLint - PENDING Desc: Run gitlint Output: ############################## Test: BluezMake - FAIL Desc: Build BlueZ Output: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12907:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12907 | int main(int argc, char *argv[]) | ^~~~ unit/test-avdtp.c: In function ‘main’: unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 766 | int main(int argc, char *argv[]) | ^~~~ unit/test-avrcp.c: In function ‘main’: unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 989 | int main(int argc, char *argv[]) | ^~~~ profiles/audio/avrcp.c: In function ‘avrcp_volume_changed’: profiles/audio/avrcp.c:3799:23: error: unused variable ‘player’ [-Werror=unused-variable] 3799 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ profiles/audio/avrcp.c: In function ‘avrcp_handle_set_volume’: profiles/audio/avrcp.c:4637:23: error: unused variable ‘player’ [-Werror=unused-variable] 4637 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:8427: profiles/audio/bluetoothd-avrcp.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4033: all] Error 2 ############################## Test: MakeCheck - FAIL Desc: Run Bluez Make Check Output: profiles/audio/media.c: In function ‘media_player_get_duration’: profiles/audio/media.c:2035:11: error: ‘struct media_player’ has no member named ‘duration’ 2035 | return mp->duration; | ^~ profiles/audio/media.c: In function ‘set_position’: profiles/audio/media.c:2196:54: error: ‘struct media_player’ has no member named ‘duration’ 2196 | if (mp->position == UINT32_MAX || mp->position >= mp->duration) { | ^~ profiles/audio/media.c: In function ‘parse_int64_metadata’: profiles/audio/media.c:2271:5: error: ‘struct media_player’ has no member named ‘duration’ 2271 | mp->duration = value; | ^~ profiles/audio/media.c: In function ‘media_player_get_duration’: profiles/audio/media.c:2036:1: error: control reaches end of non-void function [-Werror=return-type] 2036 | } | ^ cc1: all warnings being treated as errors make[1]: *** [Makefile:8217: profiles/audio/bluetoothd-media.o] Error 1 make: *** [Makefile:10455: 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 ../../profiles/audio/media.c: In function ‘media_player_get_duration’: ../../profiles/audio/media.c:2035:11: error: ‘struct media_player’ has no member named ‘duration’ 2035 | return mp->duration; | ^~ ../../profiles/audio/media.c: In function ‘set_position’: ../../profiles/audio/media.c:2196:54: error: ‘struct media_player’ has no member named ‘duration’ 2196 | if (mp->position == UINT32_MAX || mp->position >= mp->duration) { | ^~ ../../profiles/audio/media.c: In function ‘parse_int64_metadata’: ../../profiles/audio/media.c:2271:5: error: ‘struct media_player’ has no member named ‘duration’ 2271 | mp->duration = value; | ^~ make[2]: *** [Makefile:8217: profiles/audio/bluetoothd-media.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [Makefile:4033: all] Error 2 make: *** [Makefile:10376: 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:12907:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12907 | int main(int argc, char *argv[]) | ^~~~ profiles/audio/avrcp.c: In function ‘avrcp_volume_changed’: profiles/audio/avrcp.c:3799:23: error: unused variable ‘player’ [-Werror=unused-variable] 3799 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ profiles/audio/avrcp.c: In function ‘avrcp_handle_set_volume’: profiles/audio/avrcp.c:4637:23: error: unused variable ‘player’ [-Werror=unused-variable] 4637 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:8427: profiles/audio/bluetoothd-avrcp.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:10455: check] Error 2 ############################## Test: CheckSmatch - FAIL Desc: Run smatch tool with source Output: src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:317:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:317:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%' tools/sco-tester.c: note: in included file: ./lib/bluetooth.h:232:15: warning: array of flexible structures ./lib/bluetooth.h:237:31: warning: array of flexible structures tools/bneptest.c:634:39: warning: unknown escape sequence: '\%' tools/seq2bseq.c:57:26: warning: Variable length array is used. tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' unit/avctp.c:505:34: warning: Variable length array is used. unit/avctp.c:556:34: warning: Variable length array is used. unit/test-avrcp.c:373:26: warning: Variable length array is used. unit/test-avrcp.c:398:26: warning: Variable length array is used. unit/test-avrcp.c:414:24: warning: Variable length array is used. unit/avrcp-lib.c:1085:34: warning: Variable length array is used. unit/avrcp-lib.c:1583:34: warning: Variable length array is used. unit/avrcp-lib.c:1612:34: warning: Variable length array is used. unit/avrcp-lib.c:1638:34: warning: Variable length array is used. profiles/audio/avrcp.c: In function ‘avrcp_volume_changed’: profiles/audio/avrcp.c:3799:23: error: unused variable ‘player’ [-Werror=unused-variable] 3799 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ profiles/audio/avrcp.c: In function ‘avrcp_handle_set_volume’: profiles/audio/avrcp.c:4637:23: error: unused variable ‘player’ [-Werror=unused-variable] 4637 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:8427: profiles/audio/bluetoothd-avrcp.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4033: all] Error 2 ############################## Test: bluezmakeextell - FAIL Desc: Build Bluez with External ELL Output: profiles/audio/avrcp.c: In function ‘avrcp_volume_changed’: profiles/audio/avrcp.c:3799:23: error: unused variable ‘player’ [-Werror=unused-variable] 3799 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ profiles/audio/avrcp.c: In function ‘avrcp_handle_set_volume’: profiles/audio/avrcp.c:4637:23: error: unused variable ‘player’ [-Werror=unused-variable] 4637 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:8427: profiles/audio/bluetoothd-avrcp.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4033: all] Error 2 ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: ############################## Test: ScanBuild - FAIL Desc: Run Scan Build Output: src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed gatt_db_unregister(op->client->db, op->db_id); ^~~~~~~~~~ src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed discovery_op_complete(op, false, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1296:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1361:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1636:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1641:2: warning: Use of memory after it is freed discover_all(op); ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2147:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2155:8: warning: Use of memory after it is freed discovery_op_ref(op), ^~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3180:2: warning: Use of memory after it is freed complete_write_long_op(req, success, 0, false); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3202:2: warning: Use of memory after it is freed request_unref(req); ^~~~~~~~~~~~~~~~~~ 12 warnings generated. src/shared/bap.c:1528:8: warning: Use of memory after it is freed bap = bt_bap_ref_safe(bap); ^~~~~~~~~~~~~~~~~~~~ src/shared/bap.c:2310:20: warning: Use of memory after it is freed return queue_find(stream->bap->streams, NULL, stream); ^~~~~~~~~~~~~~~~~~~~ 2 warnings generated. src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed gatt_db_unregister(op->client->db, op->db_id); ^~~~~~~~~~ src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed discovery_op_complete(op, false, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1296:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1361:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1636:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1641:2: warning: Use of memory after it is freed discover_all(op); ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2147:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2155:8: warning: Use of memory after it is freed discovery_op_ref(op), ^~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3180:2: warning: Use of memory after it is freed complete_write_long_op(req, success, 0, false); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3202:2: warning: Use of memory after it is freed request_unref(req); ^~~~~~~~~~~~~~~~~~ 12 warnings generated. tools/hciattach.c:817:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 10)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:865:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:887:8: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 10)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:909:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:930:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:974:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 6)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 warnings generated. src/shared/bap.c:1528:8: warning: Use of memory after it is freed bap = bt_bap_ref_safe(bap); ^~~~~~~~~~~~~~~~~~~~ src/shared/bap.c:2310:20: warning: Use of memory after it is freed return queue_find(stream->bap->streams, NULL, stream); ^~~~~~~~~~~~~~~~~~~~ 2 warnings generated. src/oui.c:50:2: warning: Value stored to 'hwdb' is never read hwdb = udev_hwdb_unref(hwdb); ^ ~~~~~~~~~~~~~~~~~~~~~ src/oui.c:53:2: warning: Value stored to 'udev' is never read udev = udev_unref(udev); ^ ~~~~~~~~~~~~~~~~ 2 warnings generated. tools/rfcomm.c:234:3: warning: Value stored to 'i' is never read i = execvp(cmdargv[0], cmdargv); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:234:7: warning: Null pointer passed to 1st parameter expecting 'nonnull' i = execvp(cmdargv[0], cmdargv); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:354:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd' if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:497:14: warning: Assigned value is garbage or undefined req.channel = raddr.rc_channel; ^ ~~~~~~~~~~~~~~~~ tools/rfcomm.c:515:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd' if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 warnings generated. tools/hcidump.c:180:9: warning: Potential leak of memory pointed to by 'dp' if (fds[i].fd == sock) ^~~ tools/hcidump.c:248:17: warning: Assigned value is garbage or undefined dh->ts_sec = htobl(frm.ts.tv_sec); ^ ~~~~~~~~~~~~~~~~~~~~ tools/hcidump.c:326:9: warning: 1st function call argument is an uninitialized value if (be32toh(dp.flags) & 0x02) { ^~~~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:341:20: warning: 1st function call argument is an uninitialized value frm.data_len = be32toh(dp.len); ^~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:346:14: warning: 1st function call argument is an uninitialized value opcode = be32toh(dp.flags) & 0xffff; ^~~~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:384:17: warning: Assigned value is garbage or undefined frm.data_len = btohs(dh.len); ^ ~~~~~~~~~~~~~ tools/hcidump.c:394:11: warning: Assigned value is garbage or undefined frm.len = frm.data_len; ^ ~~~~~~~~~~~~ tools/hcidump.c:398:9: warning: 1st function call argument is an uninitialized value ts = be64toh(ph.ts); ^~~~~~~~~~~~~~ /usr/include/endian.h:51:22: note: expanded from macro 'be64toh' # define be64toh(x) __bswap_64 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:403:13: warning: 1st function call argument is an uninitialized value frm.in = be32toh(dp.flags) & 0x01; ^~~~~~~~~~~~~~~~~ /usr/include/endian.h:46:22: note: expanded from macro 'be32toh' # define be32toh(x) __bswap_32 (x) ^~~~~~~~~~~~~~ tools/hcidump.c:408:11: warning: Assigned value is garbage or undefined frm.in = dh.in; ^ ~~~~~ tools/hcidump.c:437:7: warning: Null pointer passed to 1st parameter expecting 'nonnull' fd = open(file, open_flags, 0644); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11 warnings generated. tools/ciptool.c:351:7: warning: 5th function call argument is an uninitialized value sk = do_connect(ctl, dev_id, &src, &dst, psm, (1 << CMTP_LOOPBACK)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. src/sdp-xml.c:126:10: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:300:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:338:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ 3 warnings generated. tools/sdptool.c:941:26: warning: Result of 'malloc' is converted to a pointer of type 'uint32_t', which is incompatible with sizeof operand type 'int' uint32_t *value_int = malloc(sizeof(int)); ~~~~~~~~~~ ^~~~~~ ~~~~~~~~~~~ tools/sdptool.c:980:4: warning: 1st function call argument is an uninitialized value free(allocArray[i]); ^~~~~~~~~~~~~~~~~~~ tools/sdptool.c:3777:2: warning: Potential leak of memory pointed to by 'si.name' return add_service(0, &si); ^~~~~~~~~~~~~~~~~~~~~~~~~~ tools/sdptool.c:4112:4: warning: Potential leak of memory pointed to by 'context.svc' return -1; ^~~~~~~~~ 4 warnings generated. tools/avtest.c:243:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:253:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:262:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:276:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:283:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:290:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:297:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:309:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:313:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:322:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:326:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:335:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:342:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:364:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:368:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:377:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:381:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:394:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:398:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:405:4: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:415:4: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:580:3: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:588:3: warning: Value stored to 'len' is never read len = write(sk, buf, invalid ? 2 : 3); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/avtest.c:602:3: warning: Value stored to 'len' is never read len = write(sk, buf, 4 + media_transport_size); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/avtest.c:615:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:625:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:637:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:652:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:664:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:673:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:680:3: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:716:2: warning: Value stored to 'len' is never read len = write(sk, buf, AVCTP_HEADER_LENGTH + sizeof(play_pressed)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 warnings generated. tools/btproxy.c:836:15: warning: Null pointer passed to 1st parameter expecting 'nonnull' tcp_port = atoi(optarg); ^~~~~~~~~~~~ tools/btproxy.c:839:8: warning: Null pointer passed to 1st parameter expecting 'nonnull' if (strlen(optarg) > 3 && !strncmp(optarg, "hci", 3)) ^~~~~~~~~~~~~~ 2 warnings generated. tools/iso-tester.c:1899:7: warning: Potential leak of memory pointed to by 'addr' err = bind(sk, (struct sockaddr *) addr, sizeof(*addr) + ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/iso-tester.c:1907:7: warning: Potential leak of memory pointed to by 'addr' err = bind(sk, (struct sockaddr *) addr, sizeof(*addr)); ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. tools/create-image.c:76:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:84:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:92:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:105:2: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ 4 warnings generated. tools/check-selftest.c:42:3: warning: Value stored to 'ptr' is never read ptr = fgets(result, sizeof(result), fp); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. tools/gatt-service.c:294:2: warning: 2nd function call argument is an uninitialized value chr_write(chr, value, len); ^~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. tools/btgatt-client.c:1824:2: warning: Value stored to 'argv' is never read argv += optind; ^ ~~~~~~ 1 warning generated. tools/btgatt-server.c:1212:2: warning: Value stored to 'argv' is never read argv -= optind; ^ ~~~~~~ 1 warning generated. tools/obex-server-tool.c:133:13: warning: Null pointer passed to 1st parameter expecting 'nonnull' data->fd = open(name, O_WRONLY | O_CREAT | O_NOCTTY, 0600); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/obex-server-tool.c:192:13: warning: Null pointer passed to 1st parameter expecting 'nonnull' data->fd = open(name, O_RDONLY | O_NOCTTY, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. tools/btpclientctl.c:402:3: warning: Value stored to 'bit' is never read bit = 0; ^ ~ tools/btpclientctl.c:1655:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull' memcpy(cp->data, ad_data, ad_len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. src/sdpd-request.c:211:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint16_t' pElem = malloc(sizeof(uint16_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ src/sdpd-request.c:239:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint32_t' pElem = malloc(sizeof(uint32_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ 2 warnings generated. unit/avrcp-lib.c:1968:3: warning: 1st function call argument is an uninitialized value g_free(text[i]); ^~~~~~~~~~~~~~~ 1 warning generated. unit/avdtp.c:756:25: warning: Use of memory after it is freed session->prio_queue = g_slist_remove(session->prio_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ unit/avdtp.c:763:24: warning: Use of memory after it is freed session->req_queue = g_slist_remove(session->req_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. profiles/audio/avdtp.c:893:25: warning: Use of memory after it is freed session->prio_queue = g_slist_remove(session->prio_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ profiles/audio/avdtp.c:900:24: warning: Use of memory after it is freed session->req_queue = g_slist_remove(session->req_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. profiles/audio/avrcp.c: In function ‘avrcp_volume_changed’: profiles/audio/avrcp.c:3799:23: error: unused variable ‘player’ [-Werror=unused-variable] 3799 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ profiles/audio/avrcp.c: In function ‘avrcp_handle_set_volume’: profiles/audio/avrcp.c:4637:23: error: unused variable ‘player’ [-Werror=unused-variable] 4637 | struct avrcp_player *player = target_get_player(session); | ^~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:8427: profiles/audio/bluetoothd-avrcp.o] Error 1 make[1]: *** Waiting for unfinished jobs.... profiles/audio/a2dp.c:375:8: warning: Use of memory after it is freed if (!cb->resume_cb) ^~~~~~~~~~~~~ profiles/audio/a2dp.c:3283:20: warning: Access to field 'starting' results in a dereference of a null pointer (loaded from variable 'stream') stream->starting = TRUE; ~~~~~~ ^ profiles/audio/a2dp.c:3286:8: warning: Access to field 'suspending' results in a dereference of a null pointer (loaded from variable 'stream') if (!stream->suspending && stream->suspend_timer) { ^~~~~~~~~~~~~~~~~~ profiles/audio/a2dp.c:3346:22: warning: Access to field 'suspending' results in a dereference of a null pointer (loaded from variable 'stream') stream->suspending = TRUE; ~~~~~~ ^ 4 warnings generated. make: *** [Makefile:4033: all] Error 2 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-06 4:32 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-08-06 1:07 [PATCH bluez v3 0/2] audio: Don't initialize media transport volume from media player Myrrh Periwinkle 2025-08-06 1:07 ` [PATCH bluez v3 1/2] " Myrrh Periwinkle 2025-08-06 2:19 ` bluez.test.bot 2025-08-06 1:07 ` [PATCH bluez v3 2/2] audio: Remove media_player.volume Myrrh Periwinkle -- strict thread matches above, loose matches on Subject: below -- 2025-08-06 2:22 [PATCH bluez v4 1/2] audio: Don't initialize media transport volume from media player Myrrh Periwinkle 2025-08-06 4:32 ` bluez.test.bot 2025-08-06 1:04 [PATCH bluez v2 1/2] " Myrrh Periwinkle 2025-08-06 2:18 ` bluez.test.bot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox