netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tipc: sparse: fix htons conversion warnings
@ 2015-03-09  9:19 erik.hugne
  2015-03-09  9:31 ` Ying Xue
  2015-03-09 19:39 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: erik.hugne @ 2015-03-09  9:19 UTC (permalink / raw)
  To: netdev
  Cc: tipc-discussion, jon.maloy, ying.xue, richard.alpe,
	laszlo.benedek, Erik Hugne

From: Erik Hugne <erik.hugne@ericsson.com>

Commit d0f91938bede ("tipc: add ip/udp media type") introduced
some new sparse warnings. Clean them up.

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
---
 net/tipc/udp_media.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 0d10001..fc2fb11 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -162,7 +162,7 @@ static int tipc_udp_send_msg(struct net *net, struct sk_buff *skb,
 		err = -ENODEV;
 		goto tx_error;
 	}
-	if (htons(dst->proto) == ETH_P_IP) {
+	if (dst->proto == htons(ETH_P_IP)) {
 		struct flowi4 fl = {
 			.daddr = dst->ipv4.s_addr,
 			.saddr = src->ipv4.s_addr,
@@ -334,7 +334,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
 	struct udp_media_addr *remote;
 	struct udp_media_addr local = {0};
 	struct udp_port_cfg udp_conf = {0};
-	struct udp_tunnel_sock_cfg tuncfg = {0};
+	struct udp_tunnel_sock_cfg tuncfg = {NULL};
 
 	ub = kzalloc(sizeof(*ub), GFP_ATOMIC);
 	if (!ub)
@@ -351,7 +351,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
 	rcu_assign_pointer(b->media_ptr, ub);
 	rcu_assign_pointer(ub->bearer, b);
 	tipc_udp_media_addr_set(&b->addr, &local);
-	if (htons(local.proto) == ETH_P_IP) {
+	if (local.proto == htons(ETH_P_IP)) {
 		struct net_device *dev;
 
 		dev = __ip_dev_find(net, local.ipv4.s_addr, false);
@@ -366,7 +366,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
 		b->mtu = dev->mtu - sizeof(struct iphdr)
 			- sizeof(struct udphdr);
 #if IS_ENABLED(CONFIG_IPV6)
-	} else if (htons(local.proto) == ETH_P_IPV6) {
+	} else if (local.proto == htons(ETH_P_IPV6)) {
 		udp_conf.family = AF_INET6;
 		udp_conf.use_udp6_tx_checksums = true;
 		udp_conf.use_udp6_rx_checksums = true;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] tipc: sparse: fix htons conversion warnings
  2015-03-09  9:19 [PATCH net-next] tipc: sparse: fix htons conversion warnings erik.hugne
@ 2015-03-09  9:31 ` Ying Xue
  2015-03-09  9:44   ` Erik Hugne
  2015-03-09 19:39 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Ying Xue @ 2015-03-09  9:31 UTC (permalink / raw)
  To: erik.hugne, netdev; +Cc: jon.maloy, laszlo.benedek, tipc-discussion

On 03/09/2015 05:19 PM, erik.hugne@ericsson.com wrote:
> From: Erik Hugne <erik.hugne@ericsson.com>
> 
> Commit d0f91938bede ("tipc: add ip/udp media type") introduced
> some new sparse warnings. Clean them up.
> 

It's better to add original sparse warning messages in commit header.

Regards,
Ying

> Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
> ---
>  net/tipc/udp_media.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
> index 0d10001..fc2fb11 100644
> --- a/net/tipc/udp_media.c
> +++ b/net/tipc/udp_media.c
> @@ -162,7 +162,7 @@ static int tipc_udp_send_msg(struct net *net, struct sk_buff *skb,
>  		err = -ENODEV;
>  		goto tx_error;
>  	}
> -	if (htons(dst->proto) == ETH_P_IP) {
> +	if (dst->proto == htons(ETH_P_IP)) {
>  		struct flowi4 fl = {
>  			.daddr = dst->ipv4.s_addr,
>  			.saddr = src->ipv4.s_addr,
> @@ -334,7 +334,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
>  	struct udp_media_addr *remote;
>  	struct udp_media_addr local = {0};
>  	struct udp_port_cfg udp_conf = {0};
> -	struct udp_tunnel_sock_cfg tuncfg = {0};
> +	struct udp_tunnel_sock_cfg tuncfg = {NULL};
>  
>  	ub = kzalloc(sizeof(*ub), GFP_ATOMIC);
>  	if (!ub)
> @@ -351,7 +351,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
>  	rcu_assign_pointer(b->media_ptr, ub);
>  	rcu_assign_pointer(ub->bearer, b);
>  	tipc_udp_media_addr_set(&b->addr, &local);
> -	if (htons(local.proto) == ETH_P_IP) {
> +	if (local.proto == htons(ETH_P_IP)) {
>  		struct net_device *dev;
>  
>  		dev = __ip_dev_find(net, local.ipv4.s_addr, false);
> @@ -366,7 +366,7 @@ static int tipc_udp_enable(struct net *net, struct tipc_bearer *b,
>  		b->mtu = dev->mtu - sizeof(struct iphdr)
>  			- sizeof(struct udphdr);
>  #if IS_ENABLED(CONFIG_IPV6)
> -	} else if (htons(local.proto) == ETH_P_IPV6) {
> +	} else if (local.proto == htons(ETH_P_IPV6)) {
>  		udp_conf.family = AF_INET6;
>  		udp_conf.use_udp6_tx_checksums = true;
>  		udp_conf.use_udp6_rx_checksums = true;
> 


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] tipc: sparse: fix htons conversion warnings
  2015-03-09  9:31 ` Ying Xue
@ 2015-03-09  9:44   ` Erik Hugne
  0 siblings, 0 replies; 4+ messages in thread
From: Erik Hugne @ 2015-03-09  9:44 UTC (permalink / raw)
  To: Ying Xue; +Cc: netdev, tipc-discussion, jon.maloy, richard.alpe, laszlo.benedek

On Mon, Mar 09, 2015 at 05:31:27PM +0800, Ying Xue wrote:
> It's better to add original sparse warning messages in commit header.

The general practice under /net seems to be the opposite though.
I'll do a resend if necessary

//E

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] tipc: sparse: fix htons conversion warnings
  2015-03-09  9:19 [PATCH net-next] tipc: sparse: fix htons conversion warnings erik.hugne
  2015-03-09  9:31 ` Ying Xue
@ 2015-03-09 19:39 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2015-03-09 19:39 UTC (permalink / raw)
  To: erik.hugne
  Cc: netdev, tipc-discussion, jon.maloy, ying.xue, richard.alpe,
	laszlo.benedek

From: <erik.hugne@ericsson.com>
Date: Mon, 9 Mar 2015 10:19:31 +0100

> From: Erik Hugne <erik.hugne@ericsson.com>
> 
> Commit d0f91938bede ("tipc: add ip/udp media type") introduced
> some new sparse warnings. Clean them up.
> 
> Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-09 19:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09  9:19 [PATCH net-next] tipc: sparse: fix htons conversion warnings erik.hugne
2015-03-09  9:31 ` Ying Xue
2015-03-09  9:44   ` Erik Hugne
2015-03-09 19:39 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).