From 032b90845e117599668a4c4a069818f4239532db Mon Sep 17 00:00:00 2001 From: Marcin Niestroj Date: Tue, 24 May 2022 12:23:04 +0200 Subject: [PATCH] modem: simcom-sim7080: fix handling failed fragment send in sendmsg() If one data fragment was not sent successfully in sendmsg(), then attempting to send the rest does not make any sense, as it would introduce hole in data stream. Currently if one fragment was not sent successfully, then there is a 'break' in inner loop, but that moves the execution to sending the following data fragments. Return early in case of fragment sending failure, so that there are no more send attempts. Signed-off-by: Marcin Niestroj --- drivers/modem/simcom-sim7080.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/modem/simcom-sim7080.c b/drivers/modem/simcom-sim7080.c index b95d0962398..dfcfb49f5b9 100644 --- a/drivers/modem/simcom-sim7080.c +++ b/drivers/modem/simcom-sim7080.c @@ -468,8 +468,7 @@ static ssize_t offload_sendmsg(void *obj, const struct msghdr *msg, int flags) if (ret == -EAGAIN) { k_sleep(K_SECONDS(1)); } else { - sent = ret; - break; + return ret; } } else { sent += ret;