From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx> v2 of the patchset with the following changes as suggested by Tanu: - Assertion used when setting card profile to "off", which cannot fail. - Transport reference counting removed. Instead, the module-bluetooth-device needs to release the transport pointer when TRANSPORT_HOOK_REMOVED is received. The proposal to extend the core with fallback card profile (see Tanu's answer to patch v1 2/8) has not been implemented here, hoping that it can be discussed later on. Cheers, Mikel >From original cover-letter: Another long patchset on Bluetooth, this time containing code cleanup and bugfixes. One of them, the isse solved in patch 4, was recently introduced in my previous patchset. Besides that, the main contribution is patch 14, which was a difficult-to-track double free. Mikel Astiz (9): bluetooth: Use assertions when setting off profile bluetooth: Check return value of init_profile() bluetooth: Check return value of start_thread() bluetooth: Remove const qualifier for transports bluetooth: Add hook to tell transport was removed bluetooth: Set to off if transport removed bluetooth: Set to off instead of failing module load bluetooth: Hold transport pointer while profile set bluetooth: Do not release transport if removed src/modules/bluetooth/bluetooth-util.c | 11 ++- src/modules/bluetooth/bluetooth-util.h | 7 +- src/modules/bluetooth/module-bluetooth-device.c | 110 +++++++++++++++--------- 3 files changed, 78 insertions(+), 50 deletions(-) -- 1.7.11.7