aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-10-22 13:05:51 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-11-08 15:54:27 -0500
commit3b7b72eed19684824806b3fbefef653a180ef2b0 (patch)
treedbaebde80ff0c62f2e2e19310520ad731c2f5c3c /net/wireless/nl80211.c
parent028f78d43d80dcb8b1142ea38606067151dd3d51 (diff)
nl80211: clean up genlmsg_end uses
genlmsg_end() cannot fail, it just returns the length of the message. Thus, error handling for it is useless. While removing it, I also noticed a useless variable and removed this it as well. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c97
1 files changed, 19 insertions, 78 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 48260c2d092a..337be50aef3b 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6634,10 +6634,7 @@ void nl80211_send_reg_change_event(struct regulatory_request *request)
6634 if (wiphy_idx_valid(request->wiphy_idx)) 6634 if (wiphy_idx_valid(request->wiphy_idx))
6635 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, request->wiphy_idx); 6635 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, request->wiphy_idx);
6636 6636
6637 if (genlmsg_end(msg, hdr) < 0) { 6637 genlmsg_end(msg, hdr);
6638 nlmsg_free(msg);
6639 return;
6640 }
6641 6638
6642 rcu_read_lock(); 6639 rcu_read_lock();
6643 genlmsg_multicast_allns(msg, 0, nl80211_regulatory_mcgrp.id, 6640 genlmsg_multicast_allns(msg, 0, nl80211_regulatory_mcgrp.id,
@@ -6673,10 +6670,7 @@ static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev,
6673 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); 6670 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
6674 NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf); 6671 NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf);
6675 6672
6676 if (genlmsg_end(msg, hdr) < 0) { 6673 genlmsg_end(msg, hdr);
6677 nlmsg_free(msg);
6678 return;
6679 }
6680 6674
6681 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 6675 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
6682 nl80211_mlme_mcgrp.id, gfp); 6676 nl80211_mlme_mcgrp.id, gfp);
@@ -6757,10 +6751,7 @@ static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev,
6757 NLA_PUT_FLAG(msg, NL80211_ATTR_TIMED_OUT); 6751 NLA_PUT_FLAG(msg, NL80211_ATTR_TIMED_OUT);
6758 NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); 6752 NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
6759 6753
6760 if (genlmsg_end(msg, hdr) < 0) { 6754 genlmsg_end(msg, hdr);
6761 nlmsg_free(msg);
6762 return;
6763 }
6764 6755
6765 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 6756 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
6766 nl80211_mlme_mcgrp.id, gfp); 6757 nl80211_mlme_mcgrp.id, gfp);
@@ -6816,10 +6807,7 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
6816 if (resp_ie) 6807 if (resp_ie)
6817 NLA_PUT(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie); 6808 NLA_PUT(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie);
6818 6809
6819 if (genlmsg_end(msg, hdr) < 0) { 6810 genlmsg_end(msg, hdr);
6820 nlmsg_free(msg);
6821 return;
6822 }
6823 6811
6824 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 6812 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
6825 nl80211_mlme_mcgrp.id, gfp); 6813 nl80211_mlme_mcgrp.id, gfp);
@@ -6857,10 +6845,7 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
6857 if (resp_ie) 6845 if (resp_ie)
6858 NLA_PUT(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie); 6846 NLA_PUT(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie);
6859 6847
6860 if (genlmsg_end(msg, hdr) < 0) { 6848 genlmsg_end(msg, hdr);
6861 nlmsg_free(msg);
6862 return;
6863 }
6864 6849
6865 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 6850 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
6866 nl80211_mlme_mcgrp.id, gfp); 6851 nl80211_mlme_mcgrp.id, gfp);
@@ -6898,10 +6883,7 @@ void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
6898 if (ie) 6883 if (ie)
6899 NLA_PUT(msg, NL80211_ATTR_IE, ie_len, ie); 6884 NLA_PUT(msg, NL80211_ATTR_IE, ie_len, ie);
6900 6885
6901 if (genlmsg_end(msg, hdr) < 0) { 6886 genlmsg_end(msg, hdr);
6902 nlmsg_free(msg);
6903 return;
6904 }
6905 6887
6906 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 6888 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
6907 nl80211_mlme_mcgrp.id, GFP_KERNEL); 6889 nl80211_mlme_mcgrp.id, GFP_KERNEL);
@@ -6934,10 +6916,7 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
6934 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); 6916 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
6935 NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid); 6917 NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid);
6936 6918
6937 if (genlmsg_end(msg, hdr) < 0) { 6919 genlmsg_end(msg, hdr);
6938 nlmsg_free(msg);
6939 return;
6940 }
6941 6920
6942 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 6921 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
6943 nl80211_mlme_mcgrp.id, gfp); 6922 nl80211_mlme_mcgrp.id, gfp);
@@ -6972,10 +6951,7 @@ void nl80211_send_new_peer_candidate(struct cfg80211_registered_device *rdev,
6972 if (ie_len && ie) 6951 if (ie_len && ie)
6973 NLA_PUT(msg, NL80211_ATTR_IE, ie_len , ie); 6952 NLA_PUT(msg, NL80211_ATTR_IE, ie_len , ie);
6974 6953
6975 if (genlmsg_end(msg, hdr) < 0) { 6954 genlmsg_end(msg, hdr);
6976 nlmsg_free(msg);
6977 return;
6978 }
6979 6955
6980 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 6956 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
6981 nl80211_mlme_mcgrp.id, gfp); 6957 nl80211_mlme_mcgrp.id, gfp);
@@ -7014,10 +6990,7 @@ void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
7014 if (tsc) 6990 if (tsc)
7015 NLA_PUT(msg, NL80211_ATTR_KEY_SEQ, 6, tsc); 6991 NLA_PUT(msg, NL80211_ATTR_KEY_SEQ, 6, tsc);
7016 6992
7017 if (genlmsg_end(msg, hdr) < 0) { 6993 genlmsg_end(msg, hdr);
7018 nlmsg_free(msg);
7019 return;
7020 }
7021 6994
7022 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 6995 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
7023 nl80211_mlme_mcgrp.id, gfp); 6996 nl80211_mlme_mcgrp.id, gfp);
@@ -7068,10 +7041,7 @@ void nl80211_send_beacon_hint_event(struct wiphy *wiphy,
7068 goto nla_put_failure; 7041 goto nla_put_failure;
7069 nla_nest_end(msg, nl_freq); 7042 nla_nest_end(msg, nl_freq);
7070 7043
7071 if (genlmsg_end(msg, hdr) < 0) { 7044 genlmsg_end(msg, hdr);
7072 nlmsg_free(msg);
7073 return;
7074 }
7075 7045
7076 rcu_read_lock(); 7046 rcu_read_lock();
7077 genlmsg_multicast_allns(msg, 0, nl80211_regulatory_mcgrp.id, 7047 genlmsg_multicast_allns(msg, 0, nl80211_regulatory_mcgrp.id,
@@ -7114,10 +7084,7 @@ static void nl80211_send_remain_on_chan_event(
7114 if (cmd == NL80211_CMD_REMAIN_ON_CHANNEL) 7084 if (cmd == NL80211_CMD_REMAIN_ON_CHANNEL)
7115 NLA_PUT_U32(msg, NL80211_ATTR_DURATION, duration); 7085 NLA_PUT_U32(msg, NL80211_ATTR_DURATION, duration);
7116 7086
7117 if (genlmsg_end(msg, hdr) < 0) { 7087 genlmsg_end(msg, hdr);
7118 nlmsg_free(msg);
7119 return;
7120 }
7121 7088
7122 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 7089 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
7123 nl80211_mlme_mcgrp.id, gfp); 7090 nl80211_mlme_mcgrp.id, gfp);
@@ -7188,10 +7155,7 @@ void nl80211_send_sta_del_event(struct cfg80211_registered_device *rdev,
7188 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); 7155 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex);
7189 NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); 7156 NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
7190 7157
7191 if (genlmsg_end(msg, hdr) < 0) { 7158 genlmsg_end(msg, hdr);
7192 nlmsg_free(msg);
7193 return;
7194 }
7195 7159
7196 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 7160 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
7197 nl80211_mlme_mcgrp.id, gfp); 7161 nl80211_mlme_mcgrp.id, gfp);
@@ -7208,7 +7172,6 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
7208{ 7172{
7209 struct sk_buff *msg; 7173 struct sk_buff *msg;
7210 void *hdr; 7174 void *hdr;
7211 int err;
7212 7175
7213 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); 7176 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
7214 if (!msg) 7177 if (!msg)
@@ -7225,16 +7188,9 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
7225 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq); 7188 NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq);
7226 NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf); 7189 NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf);
7227 7190
7228 err = genlmsg_end(msg, hdr); 7191 genlmsg_end(msg, hdr);
7229 if (err < 0) {
7230 nlmsg_free(msg);
7231 return err;
7232 }
7233 7192
7234 err = genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlpid); 7193 return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlpid);
7235 if (err < 0)
7236 return err;
7237 return 0;
7238 7194
7239 nla_put_failure: 7195 nla_put_failure:
7240 genlmsg_cancel(msg, hdr); 7196 genlmsg_cancel(msg, hdr);
@@ -7267,10 +7223,7 @@ void nl80211_send_mgmt_tx_status(struct cfg80211_registered_device *rdev,
7267 if (ack) 7223 if (ack)
7268 NLA_PUT_FLAG(msg, NL80211_ATTR_ACK); 7224 NLA_PUT_FLAG(msg, NL80211_ATTR_ACK);
7269 7225
7270 if (genlmsg_end(msg, hdr) < 0) { 7226 genlmsg_end(msg, hdr);
7271 nlmsg_free(msg);
7272 return;
7273 }
7274 7227
7275 genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp); 7228 genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp);
7276 return; 7229 return;
@@ -7312,10 +7265,7 @@ nl80211_send_cqm_rssi_notify(struct cfg80211_registered_device *rdev,
7312 7265
7313 nla_nest_end(msg, pinfoattr); 7266 nla_nest_end(msg, pinfoattr);
7314 7267
7315 if (genlmsg_end(msg, hdr) < 0) { 7268 genlmsg_end(msg, hdr);
7316 nlmsg_free(msg);
7317 return;
7318 }
7319 7269
7320 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 7270 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
7321 nl80211_mlme_mcgrp.id, gfp); 7271 nl80211_mlme_mcgrp.id, gfp);
@@ -7357,10 +7307,7 @@ void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev,
7357 7307
7358 nla_nest_end(msg, rekey_attr); 7308 nla_nest_end(msg, rekey_attr);
7359 7309
7360 if (genlmsg_end(msg, hdr) < 0) { 7310 genlmsg_end(msg, hdr);
7361 nlmsg_free(msg);
7362 return;
7363 }
7364 7311
7365 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 7312 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
7366 nl80211_mlme_mcgrp.id, gfp); 7313 nl80211_mlme_mcgrp.id, gfp);
@@ -7403,10 +7350,7 @@ void nl80211_pmksa_candidate_notify(struct cfg80211_registered_device *rdev,
7403 7350
7404 nla_nest_end(msg, attr); 7351 nla_nest_end(msg, attr);
7405 7352
7406 if (genlmsg_end(msg, hdr) < 0) { 7353 genlmsg_end(msg, hdr);
7407 nlmsg_free(msg);
7408 return;
7409 }
7410 7354
7411 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 7355 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
7412 nl80211_mlme_mcgrp.id, gfp); 7356 nl80211_mlme_mcgrp.id, gfp);
@@ -7448,10 +7392,7 @@ nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev,
7448 7392
7449 nla_nest_end(msg, pinfoattr); 7393 nla_nest_end(msg, pinfoattr);
7450 7394
7451 if (genlmsg_end(msg, hdr) < 0) { 7395 genlmsg_end(msg, hdr);
7452 nlmsg_free(msg);
7453 return;
7454 }
7455 7396
7456 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, 7397 genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
7457 nl80211_mlme_mcgrp.id, gfp); 7398 nl80211_mlme_mcgrp.id, gfp);