Skip to content

Commit 4b0252e

Browse files
amarkovicsacarlescufi
authored andcommitted
drivers: modem: Fix Coverity issue in ublox-sara-r4.c
Coverity reported unused value for a variable "ret" in the function send_socket_data(). Indeed there were two subsequent assignments to "ret", meaning that the first one was unused. The root cause of the problem is not checking the value of "ret" after correctly invoking a function within send_socket_data(). Fix this by adding appropriate checks. Coverity-CID: 215249 Signed-off-by: Aleksandar Markovic <[email protected]>
1 parent df5d1f2 commit 4b0252e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/modem/ublox-sara-r4.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ static ssize_t send_socket_data(void *obj,
343343
}
344344

345345
ret = modem_context_get_addr_port(dst_addr, &dst_port);
346+
if (ret != 0) {
347+
LOG_ERR("Error getting port from IP address %d", ret);
348+
goto exit;
349+
}
350+
346351
snprintk(send_buf, sizeof(send_buf),
347352
"AT+USOST=%d,\"%s\",%u,%zu", sock->id,
348353
ip_str,

0 commit comments

Comments
 (0)