diff options
author | Denis Kenzior <denkenz@gmail.com> | 2024-04-29 16:22:25 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2024-04-29 16:22:25 -0500 |
commit | c5afab6e824c413b457d86eccbb1275487034b62 (patch) | |
tree | e193735d9441d5da2fb5df0b2e6cc9a50605f32e | |
parent | 2da0527477383561ca476d738096145a5dab74d1 (diff) | |
download | ofono-c5afab6e824c413b457d86eccbb1275487034b62.tar.gz |
qmi: voicecall: Reflow the logic to avoid nesting
-rw-r--r-- | drivers/qmimodem/voicecall.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/qmimodem/voicecall.c b/drivers/qmimodem/voicecall.c index 0df652263..bb4c4c2ce 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, |