[dpdk-dev,v2] mbuf: cleanup rte_pktmbuf_lastseg function

Message ID 20171209210822.21927-1-matvejchikov@gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Ilya Matveychikov Dec. 9, 2017, 9:08 p.m. UTC
  There is no reason to have local variable m2.

Fixes: af75078fece3 ("first public release")
Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
---
 lib/librte_mbuf/rte_mbuf.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
  

Comments

Olivier Matz Dec. 14, 2017, 8:48 a.m. UTC | #1
On Sun, Dec 10, 2017 at 12:08:22AM +0300, Ilya V. Matveychikov wrote:
> There is no reason to have local variable m2.
> 
> Fixes: af75078fece3 ("first public release")
> Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>

Acked-by: Olivier Matz <olivier.matz@6wind.com>
  
Olivier Matz Dec. 14, 2017, 9:30 a.m. UTC | #2
On Thu, Dec 14, 2017 at 09:48:29AM +0100, Olivier MATZ wrote:
> On Sun, Dec 10, 2017 at 12:08:22AM +0300, Ilya V. Matveychikov wrote:
> > There is no reason to have local variable m2.
> > 
> > Fixes: af75078fece3 ("first public release")
> > Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Just realized the title does not match ./devtools/check-git-log.sh
constraints. I suggest instead:

  mbuf: cleanup function to get last segment
  
Thomas Monjalon Jan. 11, 2018, 11:21 p.m. UTC | #3
14/12/2017 10:30, Olivier MATZ:
> On Thu, Dec 14, 2017 at 09:48:29AM +0100, Olivier MATZ wrote:
> > On Sun, Dec 10, 2017 at 12:08:22AM +0300, Ilya V. Matveychikov wrote:
> > > There is no reason to have local variable m2.
> > > 
> > > Fixes: af75078fece3 ("first public release")
> > > Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>
> > 
> > Acked-by: Olivier Matz <olivier.matz@6wind.com>
> 
> Just realized the title does not match ./devtools/check-git-log.sh
> constraints. I suggest instead:
> 
>   mbuf: cleanup function to get last segment

Applied, thanks
  

Patch

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index ce8a05ddf..e4e3917f6 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1541,12 +1541,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;
 }
 
 /**