($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@lists.linux.dev, adam@piggz.co.uk
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH 1/2] qmi: voicecall: Reflow the logic to avoid nesting
Date: Mon, 29 Apr 2024 16:26:15 -0500	[thread overview]
Message-ID: <20240429212640.11474-1-denkenz@gmail.com> (raw)

---
 drivers/qmimodem/voicecall.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/qmimodem/voicecall.c b/drivers/qmimodem/voicecall.c
index 0df65226307d..bb4c4c2ce204 100644
--- a/drivers/qmimodem/voicecall.c
+++ b/drivers/qmimodem/voicecall.c
@@ -692,20 +692,18 @@ static void send_one_dtmf_cb(const struct ofono_error *error, void *data)
 
 	DBG("");
 
-	if (error->type != OFONO_ERROR_TYPE_NO_ERROR ||
-			*vd->next_dtmf == 0) {
-		if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
-			CALLBACK_WITH_SUCCESS(vd->send_dtmf_cb, vd->send_dtmf_data);
-		else
-			CALLBACK_WITH_FAILURE(vd->send_dtmf_cb, vd->send_dtmf_data);
-
-		l_free(vd->full_dtmf);
-		vd->full_dtmf = NULL;
-	} else {
-		send_one_dtmf(vc,
-				*(vd->next_dtmf++),
-				send_one_dtmf_cb, vd);
+	if (error->type == OFONO_ERROR_TYPE_NO_ERROR && *vd->next_dtmf) {
+		send_one_dtmf(vc, *(vd->next_dtmf++), send_one_dtmf_cb, vd);
+		return;
 	}
+
+	if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
+		CALLBACK_WITH_SUCCESS(vd->send_dtmf_cb, vd->send_dtmf_data);
+	else
+		CALLBACK_WITH_FAILURE(vd->send_dtmf_cb, vd->send_dtmf_data);
+
+	l_free(vd->full_dtmf);
+	vd->full_dtmf = NULL;
 }
 
 static void send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
-- 
2.44.0


             reply	other threads:[~2024-04-29 21:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29 21:26 Denis Kenzior [this message]
2024-04-29 21:26 ` [PATCH 2/2] qmi: voicecall: Add free on the error path Denis Kenzior
2024-04-30 16:20 ` [PATCH 1/2] qmi: voicecall: Reflow the logic to avoid nesting patchwork-bot+ofono

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240429212640.11474-1-denkenz@gmail.com \
    --to=denkenz@gmail.com \
    --cc=adam@piggz.co.uk \
    --cc=ofono@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).