Commit c1c9a3c9 authored by YueHaibing's avatar YueHaibing Committed by David S. Miller

net: remove unnecessary genlmsg_cancel() calls

the message be freed immediately, no need to trim it
back to the previous size.

Inspired by commit 7a9b3ec1 ("nl80211: remove unnecessary genlmsg_cancel() calls")
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 77ab8d5d
...@@ -2426,7 +2426,6 @@ static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq, ...@@ -2426,7 +2426,6 @@ static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq,
nla_put_failure: nla_put_failure:
err = -EMSGSIZE; err = -EMSGSIZE;
errout: errout:
genlmsg_cancel(skb, hdr);
nlmsg_free(skb); nlmsg_free(skb);
return err; return err;
} }
...@@ -2720,7 +2719,6 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq, ...@@ -2720,7 +2719,6 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq,
nla_put_failure: nla_put_failure:
err = -EMSGSIZE; err = -EMSGSIZE;
errout: errout:
genlmsg_cancel(skb, hdr);
nlmsg_free(skb); nlmsg_free(skb);
return err; return err;
} }
......
...@@ -2514,7 +2514,6 @@ static void hwsim_mcast_new_radio(int id, struct genl_info *info, ...@@ -2514,7 +2514,6 @@ static void hwsim_mcast_new_radio(int id, struct genl_info *info,
return; return;
out_err: out_err:
genlmsg_cancel(mcast_skb, data);
nlmsg_free(mcast_skb); nlmsg_free(mcast_skb);
} }
......
...@@ -1826,7 +1826,6 @@ static int devlink_dpipe_tables_fill(struct genl_info *info, ...@@ -1826,7 +1826,6 @@ static int devlink_dpipe_tables_fill(struct genl_info *info,
nla_put_failure: nla_put_failure:
err = -EMSGSIZE; err = -EMSGSIZE;
err_table_put: err_table_put:
genlmsg_cancel(skb, hdr);
nlmsg_free(skb); nlmsg_free(skb);
return err; return err;
} }
...@@ -2032,7 +2031,6 @@ int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx) ...@@ -2032,7 +2031,6 @@ int devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx)
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(dump_ctx->skb, dump_ctx->hdr);
nlmsg_free(dump_ctx->skb); nlmsg_free(dump_ctx->skb);
return -EMSGSIZE; return -EMSGSIZE;
} }
...@@ -2249,7 +2247,6 @@ static int devlink_dpipe_headers_fill(struct genl_info *info, ...@@ -2249,7 +2247,6 @@ static int devlink_dpipe_headers_fill(struct genl_info *info,
nla_put_failure: nla_put_failure:
err = -EMSGSIZE; err = -EMSGSIZE;
err_table_put: err_table_put:
genlmsg_cancel(skb, hdr);
nlmsg_free(skb); nlmsg_free(skb);
return err; return err;
} }
...@@ -2551,7 +2548,6 @@ static int devlink_resource_fill(struct genl_info *info, ...@@ -2551,7 +2548,6 @@ static int devlink_resource_fill(struct genl_info *info,
err = -EMSGSIZE; err = -EMSGSIZE;
err_resource_put: err_resource_put:
err_skb_send_alloc: err_skb_send_alloc:
genlmsg_cancel(skb, hdr);
nlmsg_free(skb); nlmsg_free(skb);
return err; return err;
} }
......
...@@ -226,7 +226,6 @@ static int seg6_genl_get_tunsrc(struct sk_buff *skb, struct genl_info *info) ...@@ -226,7 +226,6 @@ static int seg6_genl_get_tunsrc(struct sk_buff *skb, struct genl_info *info)
nla_put_failure: nla_put_failure:
rcu_read_unlock(); rcu_read_unlock();
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -ENOMEM; return -ENOMEM;
......
...@@ -201,7 +201,6 @@ static int ncsi_pkg_info_nl(struct sk_buff *msg, struct genl_info *info) ...@@ -201,7 +201,6 @@ static int ncsi_pkg_info_nl(struct sk_buff *msg, struct genl_info *info)
return genlmsg_reply(skb, info); return genlmsg_reply(skb, info);
err: err:
genlmsg_cancel(skb, hdr);
kfree_skb(skb); kfree_skb(skb);
return rc; return rc;
} }
......
...@@ -206,7 +206,6 @@ int nfc_genl_targets_found(struct nfc_dev *dev) ...@@ -206,7 +206,6 @@ int nfc_genl_targets_found(struct nfc_dev *dev)
return genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); return genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC);
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -237,7 +236,6 @@ int nfc_genl_target_lost(struct nfc_dev *dev, u32 target_idx) ...@@ -237,7 +236,6 @@ int nfc_genl_target_lost(struct nfc_dev *dev, u32 target_idx)
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -269,7 +267,6 @@ int nfc_genl_tm_activated(struct nfc_dev *dev, u32 protocol) ...@@ -269,7 +267,6 @@ int nfc_genl_tm_activated(struct nfc_dev *dev, u32 protocol)
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -299,7 +296,6 @@ int nfc_genl_tm_deactivated(struct nfc_dev *dev) ...@@ -299,7 +296,6 @@ int nfc_genl_tm_deactivated(struct nfc_dev *dev)
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -340,7 +336,6 @@ int nfc_genl_device_added(struct nfc_dev *dev) ...@@ -340,7 +336,6 @@ int nfc_genl_device_added(struct nfc_dev *dev)
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -370,7 +365,6 @@ int nfc_genl_device_removed(struct nfc_dev *dev) ...@@ -370,7 +365,6 @@ int nfc_genl_device_removed(struct nfc_dev *dev)
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -434,8 +428,6 @@ int nfc_genl_llc_send_sdres(struct nfc_dev *dev, struct hlist_head *sdres_list) ...@@ -434,8 +428,6 @@ int nfc_genl_llc_send_sdres(struct nfc_dev *dev, struct hlist_head *sdres_list)
return genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); return genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC);
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
...@@ -470,7 +462,6 @@ int nfc_genl_se_added(struct nfc_dev *dev, u32 se_idx, u16 type) ...@@ -470,7 +462,6 @@ int nfc_genl_se_added(struct nfc_dev *dev, u32 se_idx, u16 type)
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -501,7 +492,6 @@ int nfc_genl_se_removed(struct nfc_dev *dev, u32 se_idx) ...@@ -501,7 +492,6 @@ int nfc_genl_se_removed(struct nfc_dev *dev, u32 se_idx)
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -546,7 +536,6 @@ int nfc_genl_se_transaction(struct nfc_dev *dev, u8 se_idx, ...@@ -546,7 +536,6 @@ int nfc_genl_se_transaction(struct nfc_dev *dev, u8 se_idx,
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
/* evt_transaction is no more used */ /* evt_transaction is no more used */
devm_kfree(&dev->dev, evt_transaction); devm_kfree(&dev->dev, evt_transaction);
...@@ -585,7 +574,6 @@ int nfc_genl_se_connectivity(struct nfc_dev *dev, u8 se_idx) ...@@ -585,7 +574,6 @@ int nfc_genl_se_connectivity(struct nfc_dev *dev, u8 se_idx)
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -703,7 +691,6 @@ int nfc_genl_dep_link_up_event(struct nfc_dev *dev, u32 target_idx, ...@@ -703,7 +691,6 @@ int nfc_genl_dep_link_up_event(struct nfc_dev *dev, u32 target_idx,
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -735,7 +722,6 @@ int nfc_genl_dep_link_down_event(struct nfc_dev *dev) ...@@ -735,7 +722,6 @@ int nfc_genl_dep_link_down_event(struct nfc_dev *dev)
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -1030,7 +1016,6 @@ static int nfc_genl_send_params(struct sk_buff *msg, ...@@ -1030,7 +1016,6 @@ static int nfc_genl_send_params(struct sk_buff *msg,
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr); genlmsg_cancel(msg, hdr);
return -EMSGSIZE; return -EMSGSIZE;
} }
...@@ -1290,7 +1275,6 @@ int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name, ...@@ -1290,7 +1275,6 @@ int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name,
return 0; return 0;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
return -EMSGSIZE; return -EMSGSIZE;
...@@ -1507,7 +1491,6 @@ static void se_io_cb(void *context, u8 *apdu, size_t apdu_len, int err) ...@@ -1507,7 +1491,6 @@ static void se_io_cb(void *context, u8 *apdu, size_t apdu_len, int err)
return; return;
nla_put_failure: nla_put_failure:
genlmsg_cancel(msg, hdr);
free_msg: free_msg:
nlmsg_free(msg); nlmsg_free(msg);
kfree(ctx); kfree(ctx);
......
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