Commit b51eb57d authored by Arkadi Sharshevsky's avatar Arkadi Sharshevsky Committed by Greg Kroah-Hartman

devlink: Remove redundant free on error path


[ Upstream commit 7fe4d6dc ]

The current code performs unneeded free. Remove the redundant skb freeing
during the error path.

Fixes: 1555d204 ("devlink: Support for pipeline debug (dpipe)")
Signed-off-by: default avatarArkadi Sharshevsky <arkadis@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 67a1dc56
...@@ -1776,7 +1776,7 @@ static int devlink_dpipe_tables_fill(struct genl_info *info, ...@@ -1776,7 +1776,7 @@ static int devlink_dpipe_tables_fill(struct genl_info *info,
if (!nlh) { if (!nlh) {
err = devlink_dpipe_send_and_alloc_skb(&skb, info); err = devlink_dpipe_send_and_alloc_skb(&skb, info);
if (err) if (err)
goto err_skb_send_alloc; return err;
goto send_done; goto send_done;
} }
...@@ -1785,7 +1785,6 @@ static int devlink_dpipe_tables_fill(struct genl_info *info, ...@@ -1785,7 +1785,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:
err_skb_send_alloc:
genlmsg_cancel(skb, hdr); genlmsg_cancel(skb, hdr);
nlmsg_free(skb); nlmsg_free(skb);
return err; return err;
...@@ -2051,7 +2050,7 @@ static int devlink_dpipe_entries_fill(struct genl_info *info, ...@@ -2051,7 +2050,7 @@ static int devlink_dpipe_entries_fill(struct genl_info *info,
table->counters_enabled, table->counters_enabled,
&dump_ctx); &dump_ctx);
if (err) if (err)
goto err_entries_dump; return err;
send_done: send_done:
nlh = nlmsg_put(dump_ctx.skb, info->snd_portid, info->snd_seq, nlh = nlmsg_put(dump_ctx.skb, info->snd_portid, info->snd_seq,
...@@ -2059,16 +2058,10 @@ static int devlink_dpipe_entries_fill(struct genl_info *info, ...@@ -2059,16 +2058,10 @@ static int devlink_dpipe_entries_fill(struct genl_info *info,
if (!nlh) { if (!nlh) {
err = devlink_dpipe_send_and_alloc_skb(&dump_ctx.skb, info); err = devlink_dpipe_send_and_alloc_skb(&dump_ctx.skb, info);
if (err) if (err)
goto err_skb_send_alloc; return err;
goto send_done; goto send_done;
} }
return genlmsg_reply(dump_ctx.skb, info); return genlmsg_reply(dump_ctx.skb, info);
err_entries_dump:
err_skb_send_alloc:
genlmsg_cancel(dump_ctx.skb, dump_ctx.hdr);
nlmsg_free(dump_ctx.skb);
return err;
} }
static int devlink_nl_cmd_dpipe_entries_get(struct sk_buff *skb, static int devlink_nl_cmd_dpipe_entries_get(struct sk_buff *skb,
...@@ -2207,7 +2200,7 @@ static int devlink_dpipe_headers_fill(struct genl_info *info, ...@@ -2207,7 +2200,7 @@ static int devlink_dpipe_headers_fill(struct genl_info *info,
if (!nlh) { if (!nlh) {
err = devlink_dpipe_send_and_alloc_skb(&skb, info); err = devlink_dpipe_send_and_alloc_skb(&skb, info);
if (err) if (err)
goto err_skb_send_alloc; return err;
goto send_done; goto send_done;
} }
return genlmsg_reply(skb, info); return genlmsg_reply(skb, info);
...@@ -2215,7 +2208,6 @@ static int devlink_dpipe_headers_fill(struct genl_info *info, ...@@ -2215,7 +2208,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:
err_skb_send_alloc:
genlmsg_cancel(skb, hdr); genlmsg_cancel(skb, hdr);
nlmsg_free(skb); nlmsg_free(skb);
return err; return err;
......
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