public inbox for ofono@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 1/2] qmi: voicecall: Reflow the logic to avoid nesting
@ 2024-04-29 21:26 Denis Kenzior
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Denis Kenzior @ 2024-04-29 21:26 UTC (permalink / raw)
  To: ofono, adam; +Cc: Denis Kenzior

---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] qmi: voicecall: Add free on the error path
  2024-04-29 21:26 [PATCH 1/2] qmi: voicecall: Reflow the logic to avoid nesting Denis Kenzior
@ 2024-04-29 21:26 ` Denis Kenzior
  2024-04-30 16:20 ` [PATCH 1/2] qmi: voicecall: Reflow the logic to avoid nesting patchwork-bot+ofono
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2024-04-29 21:26 UTC (permalink / raw)
  To: ofono, adam; +Cc: Denis Kenzior

send_one_dtmf() allocates cb_data, but does not properly clean it up on
the (rather unlikely) error path.
---
 drivers/qmimodem/voicecall.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/qmimodem/voicecall.c b/drivers/qmimodem/voicecall.c
index bb4c4c2ce204..c6383a563b6e 100644
--- a/drivers/qmimodem/voicecall.c
+++ b/drivers/qmimodem/voicecall.c
@@ -682,6 +682,7 @@ static void send_one_dtmf(struct ofono_voicecall *vc, const char dtmf,
 error:
 	CALLBACK_WITH_FAILURE(cb, data);
 	l_free(param);
+	cb_data_unref(cbd);
 }
 
 static void send_one_dtmf_cb(const struct ofono_error *error, void *data)
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] qmi: voicecall: Reflow the logic to avoid nesting
  2024-04-29 21:26 [PATCH 1/2] qmi: voicecall: Reflow the logic to avoid nesting Denis Kenzior
  2024-04-29 21:26 ` [PATCH 2/2] qmi: voicecall: Add free on the error path Denis Kenzior
@ 2024-04-30 16:20 ` patchwork-bot+ofono
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+ofono @ 2024-04-30 16:20 UTC (permalink / raw)
  To: Denis Kenzior; +Cc: ofono, adam

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-30 16:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29 21:26 [PATCH 1/2] qmi: voicecall: Reflow the logic to avoid nesting Denis Kenzior
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox