summaryrefslogtreecommitdiffstats
path: root/net/sctp
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2014-08-22 13:03:29 +0200
committerDavid S. Miller <davem@davemloft.net>2014-08-22 11:31:30 -0700
commitea4f19c1f81d4bf709c74e3789ec785828bc6e51 (patch)
tree5917006a19b23849793cd10fff289788d89bb23a /net/sctp
parent7d149c5268d78d740cfdb20834328975251e7388 (diff)
downloadlinux-ea4f19c1f81d4bf709c74e3789ec785828bc6e51.tar.bz2
net: sctp: spare unnecessary comparison in sctp_trans_elect_best
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>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/associola.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index aaafb3250c6a..104fae489ad4 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -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);