summaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
authorBob Copeland2013-03-29 14:38:39 +0100
committerJohannes Berg2013-04-08 09:16:59 +0200
commitae76eef027f75fadd8a8eda55ee07707f077aacb (patch)
tree996060a0166128480ad5e55244438cd16448fb99 /net/mac80211/cfg.c
parentmac80211: fix the PREP mesh hwmp debug message (diff)
downloadkernel-qcow2-linux-ae76eef027f75fadd8a8eda55ee07707f077aacb.tar.gz
kernel-qcow2-linux-ae76eef027f75fadd8a8eda55ee07707f077aacb.tar.xz
kernel-qcow2-linux-ae76eef027f75fadd8a8eda55ee07707f077aacb.zip
mac80211: return new mpath from mesh_path_add()
Most times that mesh_path_add() is called, it is followed by a lookup to get the just-added mpath. We can instead just return the new mpath in the case that we allocated one (or the existing one if already there), so do that. Also, reorder the code in mesh_path_add a bit so that we don't need to allocate in the pre-existing case. Signed-off-by: Bob Copeland <bob@cozybit.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6e43feb49a76..edca2a288abd 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1540,7 +1540,6 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_sub_if_data *sdata;
struct mesh_path *mpath;
struct sta_info *sta;
- int err;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -1551,17 +1550,12 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
return -ENOENT;
}
- err = mesh_path_add(sdata, dst);
- if (err) {
+ mpath = mesh_path_add(sdata, dst);
+ if (IS_ERR(mpath)) {
rcu_read_unlock();
- return err;
+ return PTR_ERR(mpath);
}
- mpath = mesh_path_lookup(sdata, dst);
- if (!mpath) {
- rcu_read_unlock();
- return -ENXIO;
- }
mesh_path_fix_nexthop(mpath, sta);
rcu_read_unlock();