Skip to content

Commit

Permalink
devlink: Remove redundant free on error path
Browse files Browse the repository at this point in the history
The current code performs unneeded free. Remove the redundant skb freeing
during the error path.

Fixes: 1555d20 ("devlink: Support for pipeline debug (dpipe)")
Signed-off-by: Arkadi Sharshevsky <[email protected]>
Acked-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Arkadi Sharshevsky authored and davem330 committed Mar 20, 2018
1 parent 8137a8e commit 7fe4d6d
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions net/core/devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ static int devlink_dpipe_tables_fill(struct genl_info *info,
if (!nlh) {
err = devlink_dpipe_send_and_alloc_skb(&skb, info);
if (err)
goto err_skb_send_alloc;
return err;
goto send_done;
}

Expand All @@ -1807,7 +1807,6 @@ static int devlink_dpipe_tables_fill(struct genl_info *info,
nla_put_failure:
err = -EMSGSIZE;
err_table_put:
err_skb_send_alloc:
genlmsg_cancel(skb, hdr);
nlmsg_free(skb);
return err;
Expand Down Expand Up @@ -2073,24 +2072,18 @@ static int devlink_dpipe_entries_fill(struct genl_info *info,
table->counters_enabled,
&dump_ctx);
if (err)
goto err_entries_dump;
return err;

send_done:
nlh = nlmsg_put(dump_ctx.skb, info->snd_portid, info->snd_seq,
NLMSG_DONE, 0, flags | NLM_F_MULTI);
if (!nlh) {
err = devlink_dpipe_send_and_alloc_skb(&dump_ctx.skb, info);
if (err)
goto err_skb_send_alloc;
return err;
goto send_done;
}
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,
Expand Down Expand Up @@ -2229,15 +2222,14 @@ static int devlink_dpipe_headers_fill(struct genl_info *info,
if (!nlh) {
err = devlink_dpipe_send_and_alloc_skb(&skb, info);
if (err)
goto err_skb_send_alloc;
return err;
goto send_done;
}
return genlmsg_reply(skb, info);

nla_put_failure:
err = -EMSGSIZE;
err_table_put:
err_skb_send_alloc:
genlmsg_cancel(skb, hdr);
nlmsg_free(skb);
return err;
Expand Down

0 comments on commit 7fe4d6d

Please sign in to comment.