diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-09-24 13:20:38 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-09-24 14:17:28 -0700 |
commit | 2dd006d264d4f779e0c8810abfba81291fdfcda9 (patch) | |
tree | c8994fd7c5f97675c0ee3874dc50619af12e3dca /profiles | |
parent | 0ba16aa232ccc7cca7a0b241be34a330ceb96bd6 (diff) | |
download | bluez-2dd006d264d4f779e0c8810abfba81291fdfcda9.tar.gz |
avctp: Fix not handling when kernel has ERTM disabled
If kernel module is loaded with disable_ertm ERTM won't be available
thus browsing channel won't be able to be created, but it shall be
possible to still use AVRCP without it.
Fixes: https://github.com/bluez/bluez/issues/209
Diffstat (limited to 'profiles')
-rw-r--r-- | profiles/audio/avctp.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c index 702ded136..81320de1b 100644 --- a/profiles/audio/avctp.c +++ b/profiles/audio/avctp.c @@ -1651,15 +1651,6 @@ int avctp_register(struct btd_adapter *adapter, gboolean central) } server->browsing_io = avctp_server_socket(src, central, BT_IO_MODE_ERTM, AVCTP_BROWSING_PSM); - if (!server->browsing_io) { - if (server->control_io) { - g_io_channel_shutdown(server->control_io, TRUE, NULL); - g_io_channel_unref(server->control_io); - server->control_io = NULL; - } - g_free(server); - return -1; - } server->adapter = btd_adapter_ref(adapter); @@ -1681,9 +1672,11 @@ void avctp_unregister(struct btd_adapter *adapter) servers = g_slist_remove(servers, server); - g_io_channel_shutdown(server->browsing_io, TRUE, NULL); - g_io_channel_unref(server->browsing_io); - server->browsing_io = NULL; + if (server->browsing_io) { + g_io_channel_shutdown(server->browsing_io, TRUE, NULL); + g_io_channel_unref(server->browsing_io); + server->browsing_io = NULL; + } g_io_channel_shutdown(server->control_io, TRUE, NULL); g_io_channel_unref(server->control_io); |