From f9705b3f4bf1941432f836406ebb98365f939c3a Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 28 Jul 2016 16:45:30 +0300 Subject: [PATCH] audio/a2dp: Fix always setting -EAGAIN for all errors avdtp_error_posix_errno always return the posix errno not the negative one which is then assigned to perror negative and then again as negative in the switch statement making it assume the original value which is the positive errno which don't match with the expected values which are negative causing -EAGAIN to always be returned. --- profiles/audio/a2dp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c index b391fc2cc..db0736d68 100644 --- a/profiles/audio/a2dp.c +++ b/profiles/audio/a2dp.c @@ -235,11 +235,11 @@ static int error_to_errno(struct avdtp_error *err) if (avdtp_error_category(err) != AVDTP_ERRNO) return -EIO; - perr = -avdtp_error_posix_errno(err); - switch (-perr) { - case -EHOSTDOWN: - case -ECONNABORTED: - return perr; + perr = avdtp_error_posix_errno(err); + switch (perr) { + case EHOSTDOWN: + case ECONNABORTED: + return -perr; default: /* * An unexpect error has occurred setup may be attempted again. -- 2.47.3