Skip to content

Commit b4985aa

Browse files
Li Zetaokuba-moo
authored andcommitted
net: caif: use max() to simplify the code
When processing the tail append of sk buffer, the final length needs to be determined based on expectlen and addlen. Using max() here can increase the readability of the code. Signed-off-by: Li Zetao <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 77f0cae commit b4985aa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

net/caif/cfpkt_skbuff.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,8 @@ struct cfpkt *cfpkt_append(struct cfpkt *dstpkt,
298298
if (unlikely(is_erronous(dstpkt) || is_erronous(addpkt))) {
299299
return dstpkt;
300300
}
301-
if (expectlen > addlen)
302-
neededtailspace = expectlen;
303-
else
304-
neededtailspace = addlen;
301+
302+
neededtailspace = max(expectlen, addlen);
305303

306304
if (dst->tail + neededtailspace > dst->end) {
307305
/* Create a dumplicate of 'dst' with more tail space */

0 commit comments

Comments
 (0)