[dpdk-dev] [PATCH] mbuf: cleanup rte_pktmbuf_lastseg(), remove useless variable

Ilya Matveychikov matvejchikov at gmail.com
Tue Nov 14 14:44:49 CET 2017


Fixes: af75078fece3 ("first public release")
Cc: intel.com

Signed-off-by: Ilya V. Matveychikov <matvejchikov at gmail.com>
---

There is no reason to have local variable m2 or am I wrong?

 lib/librte_mbuf/rte_mbuf.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 7e326bbc2..be79e3728 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1538,12 +1538,10 @@ static inline uint16_t rte_pktmbuf_tailroom(const struct rte_mbuf *m)
  */
 static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m)
 {
-	struct rte_mbuf *m2 = (struct rte_mbuf *)m;
-
 	__rte_mbuf_sanity_check(m, 1);
-	while (m2->next != NULL)
-		m2 = m2->next;
-	return m2;
+	while (m->next != NULL)
+		m = m->next;
+	return m;
 }

 /**
--
2.15.0


More information about the dev mailing list