diff mbox series

[1/2] qmi: voicecall: Reflow the logic to avoid nesting

Message ID 20240429212640.11474-1-denkenz@gmail.com (mailing list archive)
State Accepted
Commit c5afab6e824c413b457d86eccbb1275487034b62
Headers show
Series [1/2] qmi: voicecall: Reflow the logic to avoid nesting | expand

Commit Message

Denis Kenzior April 29, 2024, 9:26 p.m. UTC
---
 drivers/qmimodem/voicecall.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

Comments

patchwork-bot+ofono@kernel.org April 30, 2024, 4:20 p.m. UTC | #1
Hello:

This series was applied to ofono.git (master)
by Denis Kenzior <denkenz@gmail.com>:

On Mon, 29 Apr 2024 16:26:15 -0500 you wrote:
> ---
>  drivers/qmimodem/voicecall.c | 24 +++++++++++-------------
>  1 file changed, 11 insertions(+), 13 deletions(-)

Here is the summary with links:
  - [1/2] qmi: voicecall: Reflow the logic to avoid nesting
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=c5afab6e824c
  - [2/2] qmi: voicecall: Add free on the error path
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=3365880efc45

You are awesome, thank you!
diff mbox series

Patch

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,