Commit 7a9b3ec1 authored by Johannes Berg's avatar Johannes Berg

nl80211: remove unnecessary genlmsg_cancel() calls

If we free the message immediately, there's no reason to
trim it back to the previous size.

Done with spatch:

@@
identifier msg, hdr;
@@
-if (hdr)
-  genlmsg_cancel(msg, hdr);
... when != msg;
 nlmsg_free(msg);

@@
identifier msg, hdr;
@@
-genlmsg_cancel(msg, hdr);
... when != msg;
 nlmsg_free(msg);
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent ff84e7bf
...@@ -5847,7 +5847,6 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, ...@@ -5847,7 +5847,6 @@ static int nl80211_get_mesh_config(struct sk_buff *skb,
return genlmsg_reply(msg, info); return genlmsg_reply(msg, info);
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
out: out:
nlmsg_free(msg); nlmsg_free(msg);
return -ENOBUFS; return -ENOBUFS;
...@@ -6328,7 +6327,6 @@ static int nl80211_get_reg_do(struct sk_buff *skb, struct genl_info *info) ...@@ -6328,7 +6327,6 @@ static int nl80211_get_reg_do(struct sk_buff *skb, struct genl_info *info)
nla_put_failure_rcu: nla_put_failure_rcu:
rcu_read_unlock(); rcu_read_unlock();
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
put_failure: put_failure:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -13732,7 +13730,6 @@ void nl80211_common_reg_change_event(enum nl80211_commands cmd_id, ...@@ -13732,7 +13730,6 @@ void nl80211_common_reg_change_event(enum nl80211_commands cmd_id,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -13780,7 +13777,6 @@ static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev, ...@@ -13780,7 +13777,6 @@ static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -13868,7 +13864,6 @@ static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev, ...@@ -13868,7 +13864,6 @@ static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -13944,7 +13939,6 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev, ...@@ -13944,7 +13939,6 @@ void nl80211_send_connect_result(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -13984,7 +13978,6 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev, ...@@ -13984,7 +13978,6 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -14014,7 +14007,6 @@ void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev, ...@@ -14014,7 +14007,6 @@ void nl80211_send_port_authorized(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -14051,7 +14043,6 @@ void nl80211_send_disconnected(struct cfg80211_registered_device *rdev, ...@@ -14051,7 +14043,6 @@ void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -14084,7 +14075,6 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, ...@@ -14084,7 +14075,6 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -14125,7 +14115,6 @@ void cfg80211_notify_new_peer_candidate(struct net_device *dev, const u8 *addr, ...@@ -14125,7 +14115,6 @@ void cfg80211_notify_new_peer_candidate(struct net_device *dev, const u8 *addr,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
EXPORT_SYMBOL(cfg80211_notify_new_peer_candidate); EXPORT_SYMBOL(cfg80211_notify_new_peer_candidate);
...@@ -14164,7 +14153,6 @@ void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, ...@@ -14164,7 +14153,6 @@ void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -14219,7 +14207,6 @@ void nl80211_send_beacon_hint_event(struct wiphy *wiphy, ...@@ -14219,7 +14207,6 @@ void nl80211_send_beacon_hint_event(struct wiphy *wiphy,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -14265,7 +14252,6 @@ static void nl80211_send_remain_on_chan_event( ...@@ -14265,7 +14252,6 @@ static void nl80211_send_remain_on_chan_event(
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -14379,7 +14365,6 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr, ...@@ -14379,7 +14365,6 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
EXPORT_SYMBOL(cfg80211_conn_failed); EXPORT_SYMBOL(cfg80211_conn_failed);
...@@ -14416,7 +14401,6 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, ...@@ -14416,7 +14401,6 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd,
return true; return true;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
return true; return true;
} }
...@@ -14500,7 +14484,6 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, ...@@ -14500,7 +14484,6 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid); return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid);
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
return -ENOBUFS; return -ENOBUFS;
} }
...@@ -14544,7 +14527,6 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie, ...@@ -14544,7 +14527,6 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
EXPORT_SYMBOL(cfg80211_mgmt_tx_status); EXPORT_SYMBOL(cfg80211_mgmt_tx_status);
...@@ -14753,7 +14735,6 @@ static void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev, ...@@ -14753,7 +14735,6 @@ static void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -14811,7 +14792,6 @@ nl80211_pmksa_candidate_notify(struct cfg80211_registered_device *rdev, ...@@ -14811,7 +14792,6 @@ nl80211_pmksa_candidate_notify(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -14864,7 +14844,6 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev, ...@@ -14864,7 +14844,6 @@ static void nl80211_ch_switch_notify(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -14946,7 +14925,6 @@ nl80211_radar_notify(struct cfg80211_registered_device *rdev, ...@@ -14946,7 +14925,6 @@ nl80211_radar_notify(struct cfg80211_registered_device *rdev,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
...@@ -15041,7 +15019,6 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr, ...@@ -15041,7 +15019,6 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
EXPORT_SYMBOL(cfg80211_probe_status); EXPORT_SYMBOL(cfg80211_probe_status);
...@@ -15086,8 +15063,6 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy, ...@@ -15086,8 +15063,6 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
nla_put_failure: nla_put_failure:
spin_unlock_bh(&rdev->beacon_registrations_lock); spin_unlock_bh(&rdev->beacon_registrations_lock);
if (hdr)
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
EXPORT_SYMBOL(cfg80211_report_obss_beacon); EXPORT_SYMBOL(cfg80211_report_obss_beacon);
...@@ -15303,7 +15278,6 @@ void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer, ...@@ -15303,7 +15278,6 @@ void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
EXPORT_SYMBOL(cfg80211_tdls_oper_request); EXPORT_SYMBOL(cfg80211_tdls_oper_request);
...@@ -15448,8 +15422,6 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp) ...@@ -15448,8 +15422,6 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp)
return; return;
nla_put_failure: nla_put_failure:
if (hdr)
genlmsg_cancel(msg, hdr);
nlmsg_free(msg); nlmsg_free(msg);
} }
EXPORT_SYMBOL(cfg80211_crit_proto_stopped); EXPORT_SYMBOL(cfg80211_crit_proto_stopped);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment