]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: sctp: spare unnecessary comparison in sctp_trans_elect_best
authorDaniel Borkmann <dborkman@redhat.com>
Fri, 22 Aug 2014 11:03:29 +0000 (13:03 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 Aug 2014 18:31:30 +0000 (11:31 -0700)
When both transports are the same, we don't have to go down that
road only to realize that we will return the very same transport.
We are guaranteed that curr is always non-NULL. Therefore, just
short-circuit this special case.

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/associola.c

index aaafb3250c6a5c6eec9c9a5401c6f4f6129bcfd5..104fae489ad4dfde925df1fe2110b6277dfec289 100644 (file)
@@ -1245,7 +1245,7 @@ static struct sctp_transport *sctp_trans_elect_best(struct sctp_transport *curr,
 {
        u8 score_curr, score_best;
 
-       if (best == NULL)
+       if (best == NULL || curr == best)
                return curr;
 
        score_curr = sctp_trans_score(curr);