From a508ccd2889384d076b1a2028f6a9d88dbee735f Mon Sep 17 00:00:00 2001 From: Archie Pusaka Date: Thu, 5 Nov 2020 14:40:34 +0800 Subject: [PATCH] audio/avdtp: Report failure in disconnected state A2DP are relying on the disconnected state callback to do cleanup. If failure occurs when AVDTP are already in the disconnected state, we didn't make any transition state, therefore A2DP would miss this event. This patch allows the transition to disconnected state, even though we are previously already in the disconnected state. Signed-off-by: Anuj Jain Signed-off-by: Ayush Garg --- profiles/audio/avdtp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index 3cc6884..5277685 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -3154,6 +3154,11 @@ static int send_req(struct avdtp *session, gboolean priority, if (session->state == AVDTP_SESSION_STATE_DISCONNECTED) { session->io = l2cap_connect(session); if (!session->io) { + /* Report disconnection anyways, as the other layers + * are using this state for cleanup. + */ + avdtp_set_state(session, + AVDTP_SESSION_STATE_DISCONNECTED); err = -EIO; goto failed; } -- 2.7.4