diff mbox series

atmodem: sim: Fix CRSM result handling

Message ID 20240528200808.239108-1-denkenz@gmail.com (mailing list archive)
State Accepted
Commit 31dfe78a070fad66ca9b84e02fe1f69cf329ef84
Headers show
Series atmodem: sim: Fix CRSM result handling | expand

Commit Message

Denis Kenzior May 28, 2024, 8:07 p.m. UTC
The previous commit tries to parse all CRSM lines until sw1 and sw2
parameters are found.  Unfortunately the current logic does not break
out of the loop once a valid result line is detected, and the iterator
is modified once again, becoming invalid.  This results in subsequent
operations (g_at_result_iter_next_hexstring) failing.  Fix that by
breaking out of the loop as soon as sw1 and sw2 parameters are read
successfully.

Fixes: 7802d80a9619 ("atmodem: sim: when reading sim files, avoid incomplete result lines")
---
 drivers/atmodem/sim.c | 1 +
 1 file changed, 1 insertion(+)

Comments

patchwork-bot+ofono@kernel.org May 28, 2024, 8:50 p.m. UTC | #1
Hello:

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

On Tue, 28 May 2024 15:07:54 -0500 you wrote:
> The previous commit tries to parse all CRSM lines until sw1 and sw2
> parameters are found.  Unfortunately the current logic does not break
> out of the loop once a valid result line is detected, and the iterator
> is modified once again, becoming invalid.  This results in subsequent
> operations (g_at_result_iter_next_hexstring) failing.  Fix that by
> breaking out of the loop as soon as sw1 and sw2 parameters are read
> successfully.
> 
> [...]

Here is the summary with links:
  - atmodem: sim: Fix CRSM result handling
    https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=31dfe78a070f

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index cbf87fb4c095..5aa89da38905 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -126,6 +126,7 @@  static void get_response_common_cb(gboolean ok, GAtResult *result,
 		if (!g_at_result_iter_next_number(&iter, &sw2))
 			continue;
 		result_found = TRUE;
+		break;
 	}
 
 	if (!result_found)