From fe826cc9714a9c8fe28c80c881707f0eafe801cf Mon Sep 17 00:00:00 2001 From: Chengyi Zhao Date: Mon, 16 Aug 2021 14:14:23 +0800 Subject: [PATCH] bluetooth: Check if transport returns an error -1 If transport_acquire returns -1, it should be returned to the upper function for processing. --- src/modules/bluetooth/module-bluez5-device.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index 5b656612c..a46cc47d7 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -1308,9 +1308,10 @@ static int setup_transport(struct userdata *u) { u->transport = t; - if (u->profile == PA_BLUETOOTH_PROFILE_A2DP_SOURCE || u->profile == PA_BLUETOOTH_PROFILE_HFP_AG || u->profile == PA_BLUETOOTH_PROFILE_HSP_AG) - transport_acquire(u, true); /* In case of error, the sink/sources will be created suspended */ - else { + if (u->profile == PA_BLUETOOTH_PROFILE_A2DP_SOURCE || u->profile == PA_BLUETOOTH_PROFILE_HFP_AG || u->profile == PA_BLUETOOTH_PROFILE_HSP_AG) { + if (transport_acquire(u, true) == -1) /* In case of error, the sink/sources will be created suspended */ + return -1; + } else { int transport_error; transport_error = transport_acquire(u, false);