[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230420193315.35e3e9e4@kernel.org>
Date: Thu, 20 Apr 2023 19:33:15 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Pedro Tammela <pctammela@...atatu.com>
Cc: netdev@...r.kernel.org, jhs@...atatu.com, xiyou.wangcong@...il.com,
jiri@...nulli.us, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, simon.horman@...igine.com
Subject: Re: [PATCH net-next v4 1/5] net/sched: act_pedit: simplify 'ex' key
parsing error propagation
On Tue, 18 Apr 2023 20:43:50 -0300 Pedro Tammela wrote:
> 'err' is returned -EINVAL most of the time.
> Make the exception be the netlink parsing and remove the
> redundant error assignments in the other code paths.
> diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
> index 4559a1507ea5..90f5214e679e 100644
> --- a/net/sched/act_pedit.c
> +++ b/net/sched/act_pedit.c
> @@ -54,46 +54,39 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla,
>
> nla_for_each_nested(ka, nla, rem) {
> struct nlattr *tb[TCA_PEDIT_KEY_EX_MAX + 1];
> + int ret;
>
> - if (!n) {
> - err = -EINVAL;
> + if (!n)
> goto err_out;
> - }
> n--;
IMHO this is not worth doing. Setting the error value before the jump
is more idiomatic. If anything I'd remove the unnecessary init of err
to EINVAL at the start of the function.
Powered by blists - more mailing lists