Skip to content

Commit

Permalink
net: sctp: simplify sctp_get_port
Browse files Browse the repository at this point in the history
No need to have an extra ret variable when we directly can return
the value of sctp_get_port_local().

Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Daniel Borkmann authored and David S. Miller committed Jun 25, 2013
1 parent 0a2fbac commit 62208f1
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions net/sctp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -6036,7 +6036,6 @@ static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr)
*/
static int sctp_get_port(struct sock *sk, unsigned short snum)
{
long ret;
union sctp_addr addr;
struct sctp_af *af = sctp_sk(sk)->pf->af;

Expand All @@ -6045,9 +6044,7 @@ static int sctp_get_port(struct sock *sk, unsigned short snum)
addr.v4.sin_port = htons(snum);

/* Note: sk->sk_num gets filled in if ephemeral port request. */
ret = sctp_get_port_local(sk, &addr);

return ret ? 1 : 0;
return !!sctp_get_port_local(sk, &addr);
}

/*
Expand Down

0 comments on commit 62208f1

Please sign in to comment.