From 50441eb9eeada15d38c3853badb1f8129b6751d1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 8 Oct 2013 09:24:37 -0600 Subject: [PATCH] uip_tcpcallback: Simplify handling of callback return flags --- net/uip/uip_tcpcallback.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/net/uip/uip_tcpcallback.c b/net/uip/uip_tcpcallback.c index 671f9d53ed..a5ac5153f9 100644 --- a/net/uip/uip_tcpcallback.c +++ b/net/uip/uip_tcpcallback.c @@ -199,8 +199,6 @@ uint16_t uip_tcpcallback(struct uip_driver_s *dev, struct uip_conn *conn, * explicitly set in the callback. */ - uint16_t ret = flags; - nllvdbg("flags: %04x\n", flags); /* Perform the data callback. When a data callback is executed from 'list', @@ -222,7 +220,7 @@ uint16_t uip_tcpcallback(struct uip_driver_s *dev, struct uip_conn *conn, * dev->d_len should also be cleared). */ - ret = uip_callbackexecute(dev, conn, flags, conn->list); + flags = uip_callbackexecute(dev, conn, flags, conn->list); /* There may be no new data handler in place at them moment that the new * incoming data is received. If the new incoming data was not handled, then @@ -231,25 +229,25 @@ uint16_t uip_tcpcallback(struct uip_driver_s *dev, struct uip_conn *conn, * be re-transmitted at a better time. */ - if ((ret & UIP_NEWDATA) != 0) + if ((flags & UIP_NEWDATA) != 0) { /* Data was not handled.. dispose of it appropriately */ - ret = uip_dataevent(dev, conn, ret); + flags = uip_dataevent(dev, conn, ret); } /* Check if there is a connection-related event and a connection * callback. */ - if (ret != 0 && ((flags & UIP_CONN_EVENTS) != 0) && conn->connection_event) + if (((flags & UIP_CONN_EVENTS) != 0) && conn->connection_event) { /* Perform the callback */ conn->connection_event(conn, flags); } - return ret; + return flags; } /****************************************************************************