netpoll: fix some sparse warnings in various places
Subsystems (5)
PATCH v4 1/1 netpoll: fix some sparse warnings in various places
From: Cong Wang <[email protected]>
This fixes sparse warnings like the one below:
drivers/net/team/team.c:953:25: warning: incorrect type in return expression (different address spaces)drivers/net/team/team.c:953:25: expected struct netpoll_info *drivers/net/team/team.c:953:25: got struct netpoll_info [noderef] <asn:4>*npinfo
---
drivers/net/bonding/bond_main.c +1 -1
@@ -1302,7 +1302,7 @@ static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, gstatic struct netpoll_info *bond_netpoll_info (struct bonding *bond) { -return bond->dev->npinfo; +return rcu_access_pointer (bond->dev->npinfo); }#else
drivers/net/team/team.c +1 -1
@@ -950,7 +950,7 @@ static void team_port_disable_netpoll(struct team_port *port)static struct netpoll_info *team_netpoll_info (struct team *team) { -return team->dev->npinfo; +return rcu_access_pointer (team->dev->npinfo); }#else
net/bridge/br_private.h +1 -1
@@ -330,7 +330,7 @@ extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,#ifdef CONFIG_NET_POLL_CONTROLLER static inline struct netpoll_info *br_netpoll_info (struct net_bridge *br) { -return br->dev->npinfo; +return rcu_access_pointer (br->dev->npinfo); } static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
Jiri Pirko
maintainerQuoted 47 lines · Sat, Feb 16, 2013 at 09:37:53AM CET, [email protected] wrote:
From: Cong Wang <[email protected]>
This fixes sparse warnings like the one below:
drivers/net/team/team.c:953:25: warning: incorrect type in return expression (different address spaces)drivers/net/team/team.c:953:25: expected structnetpoll_info*drivers/net/team/team.c:953:25: got structnetpoll_info[noderef] <asn:4>*npinfoCc Eric Dumazet <[email protected]>Cc Jiri Pirko <[email protected]>Cc Vlad Yasevich <[email protected]>Cc Stephen Hemminger <[email protected]>Cc David S. Miller <[email protected]>Signed-off-by Cong Wang <[email protected]>---
drivers/net/bonding/bond_main.c +1
-1@@ -1302,7 +1302,7 @@ static int bond_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, gstatic struct netpoll_info *bond_netpoll_info (struct bonding *bond) { -return bond->dev->npinfo; +return rcu_access_pointer (bond->dev->npinfo); }#else drivers/net/team/team.c +1
-1@@ -950,7 +950,7 @@ static void team_port_disable_netpoll(struct team_port *port)static struct netpoll_info *team_netpoll_info (struct team *team) { -return team->dev->npinfo; +return rcu_access_pointer (team->dev->npinfo); }#else net/bridge/br_private.h +0
-0
net/bridge/br_private.h extern netdev_tx_t br_dev_xmit(struct sk_buff *skb, · line 336
Quoted 8 lines
net/bridge/br_private.h +1
-1@@ -330,7 +330,7 @@ extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,#ifdef CONFIG_NET_POLL_CONTROLLER static inline struct netpoll_info *br_netpoll_info (struct net_bridge *br) { -return br->dev->npinfo; +return rcu_access_pointer (br->dev->npinfo); } static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
Hmm. I'm just wondering if there wouldn't be nicer for these functions to return bool if you just want to know if npinfo is null or not. This notation seems a bit confusing to me.
Quoted 5 lines · Jiri Pirko
Hmm. I'm just wondering if there wouldn't be nicer for these functions to
return bool if you just want to know if npinfo is null or not. This notation seems a bit confusing to me.
Yes, makes sense.