net: pkt: adjust_offset: Simplify and optimize code

An edge condition was handled in a special way, even though the main
condition covered it well. More code, more jumps == slower code,
bigger binaries.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
This commit is contained in:
Paul Sokolovsky
2017-11-01 19:08:57 +02:00
committed by Jukka Rissanen
parent ae0f3d7224
commit 971da9d011

View File

@@ -1215,11 +1215,7 @@ static inline struct net_buf *adjust_offset(struct net_buf *frag,
}
while (frag) {
if (offset == frag->len) {
*pos = 0;
return frag->frags;
} else if (offset < frag->len) {
if (offset < frag->len) {
*pos = offset;
return frag;