浏览代码

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>
Parav Pandit 7 年之前
父节点
当前提交
f89b7dfa33
共有 1 个文件被更改,包括 1 次插入4 次删除
  1. 1 4
      drivers/infiniband/core/addr.c

+ 1 - 4
drivers/infiniband/core/addr.c

@@ -392,7 +392,6 @@ static int addr4_resolve(struct sockaddr_in *src_in,
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;
 
 
-	src_in->sin_family = AF_INET;
 	src_in->sin_addr.s_addr = fl4.saddr;
 	src_in->sin_addr.s_addr = fl4.saddr;
 
 
 	/* If there's a gateway and type of device not ARPHRD_INFINIBAND, we're
 	/* 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;
 		return ret;
 
 
 	rt = (struct rt6_info *)dst;
 	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;
 		src_in->sin6_addr = fl6.saddr;
-	}
 
 
 	/* If there's a gateway and type of device not ARPHRD_INFINIBAND, we're
 	/* 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
 	 * definitely in RoCE v2 (as RoCE v1 isn't routable) set the network