Skip to content

Commit 7fe4d6d

Browse files
Arkadi Sharshevskydavem330
authored andcommitted
devlink: Remove redundant free on error path
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]>
1 parent 8137a8e commit 7fe4d6d

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

net/core/devlink.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,7 @@ static int devlink_dpipe_tables_fill(struct genl_info *info,
17981798
if (!nlh) {
17991799
err = devlink_dpipe_send_and_alloc_skb(&skb, info);
18001800
if (err)
1801-
goto err_skb_send_alloc;
1801+
return err;
18021802
goto send_done;
18031803
}
18041804

@@ -1807,7 +1807,6 @@ static int devlink_dpipe_tables_fill(struct genl_info *info,
18071807
nla_put_failure:
18081808
err = -EMSGSIZE;
18091809
err_table_put:
1810-
err_skb_send_alloc:
18111810
genlmsg_cancel(skb, hdr);
18121811
nlmsg_free(skb);
18131812
return err;
@@ -2073,24 +2072,18 @@ static int devlink_dpipe_entries_fill(struct genl_info *info,
20732072
table->counters_enabled,
20742073
&dump_ctx);
20752074
if (err)
2076-
goto err_entries_dump;
2075+
return err;
20772076

20782077
send_done:
20792078
nlh = nlmsg_put(dump_ctx.skb, info->snd_portid, info->snd_seq,
20802079
NLMSG_DONE, 0, flags | NLM_F_MULTI);
20812080
if (!nlh) {
20822081
err = devlink_dpipe_send_and_alloc_skb(&dump_ctx.skb, info);
20832082
if (err)
2084-
goto err_skb_send_alloc;
2083+
return err;
20852084
goto send_done;
20862085
}
20872086
return genlmsg_reply(dump_ctx.skb, info);
2088-
2089-
err_entries_dump:
2090-
err_skb_send_alloc:
2091-
genlmsg_cancel(dump_ctx.skb, dump_ctx.hdr);
2092-
nlmsg_free(dump_ctx.skb);
2093-
return err;
20942087
}
20952088

20962089
static int devlink_nl_cmd_dpipe_entries_get(struct sk_buff *skb,
@@ -2229,15 +2222,14 @@ static int devlink_dpipe_headers_fill(struct genl_info *info,
22292222
if (!nlh) {
22302223
err = devlink_dpipe_send_and_alloc_skb(&skb, info);
22312224
if (err)
2232-
goto err_skb_send_alloc;
2225+
return err;
22332226
goto send_done;
22342227
}
22352228
return genlmsg_reply(skb, info);
22362229

22372230
nla_put_failure:
22382231
err = -EMSGSIZE;
22392232
err_table_put:
2240-
err_skb_send_alloc:
22412233
genlmsg_cancel(skb, hdr);
22422234
nlmsg_free(skb);
22432235
return err;

0 commit comments

Comments
 (0)