tcp: Validate net_context_put return code

Validate the return code of net_context_put and add debug information
in case any error is detected.

This patch fixes the error reported by Coverity:

Error handling issues  (CHECKED_RETURN)
Calling "net_context_put" without checking return value
(as is done elsewhere 4 out of 5 times).

Coverity-CID: 157833

Change-Id: Ia4a87cc08094bee465c8828411d7c1311481695a
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
This commit is contained in:
Flavio Santes 2016-12-11 00:40:56 -06:00 committed by Tomasz Bursztyka
commit a8b73aa287

View file

@ -723,10 +723,14 @@ void net_tcp_init(void)
static void fin_timeout(struct k_work *work)
{
struct net_tcp *tcp = CONTAINER_OF(work, struct net_tcp, fin_timer);
int rc;
NET_DBG("Remote peer didn't confirm connection close");
net_context_put(tcp->context);
rc = net_context_put(tcp->context);
if (rc < 0) {
NET_DBG("Cannot close TCP context");
}
}
#if NET_DEBUG