aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/addr.c
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2018-09-05 12:54:17 +0300
committerJason Gunthorpe <jgg@mellanox.com>2018-09-12 15:48:08 -0600
commitf89b7dfa33537bba9ee082a17a55242fc727e9f4 (patch)
tree7581b01d7685d86af6275142faba762d8c33be2d /drivers/infiniband/core/addr.c
parentRDMA/core Introduce and use rdma_find_ndev_for_src_ip_rcu (diff)
downloadlinux-dev-f89b7dfa33537bba9ee082a17a55242fc727e9f4.tar.xz
linux-dev-f89b7dfa33537bba9ee082a17a55242fc727e9f4.zip
RDMA/core: Avoid unnecessary sa_family overwrite
addr4_resolve() and addr6_resolve() are called by checking the value of sa_family. Both above functions overwrite the value after typecasting, this is not necessary. Signed-off-by: Parav Pandit <parav@mellanox.com> Reviewed-by: Daniel Jurgens <danielj@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/addr.c')
-rw-r--r--drivers/infiniband/core/addr.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 50ab50f1908b..858ceffbeeaa 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -392,7 +392,6 @@ static int addr4_resolve(struct sockaddr_in *src_in,
if (ret)
return ret;
- src_in->sin_family = AF_INET;
src_in->sin_addr.s_addr = fl4.saddr;
/* If there's a gateway and type of device not ARPHRD_INFINIBAND, we're
@@ -429,10 +428,8 @@ static int addr6_resolve(struct sockaddr_in6 *src_in,
return ret;
rt = (struct rt6_info *)dst;
- if (ipv6_addr_any(&src_in->sin6_addr)) {
- src_in->sin6_family = AF_INET6;
+ if (ipv6_addr_any(&src_in->sin6_addr))
src_in->sin6_addr = fl6.saddr;
- }
/* If there's a gateway and type of device not ARPHRD_INFINIBAND, we're
* definitely in RoCE v2 (as RoCE v1 isn't routable) set the network