From: <Daniel.Machon@microchip.com>
To: <joe@perches.com>
Cc: <petrm@nvidia.com>, <netdev@vger.kernel.org>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <vladimir.oltean@nxp.com>,
<linux-kernel@vger.kernel.org>, <UNGLinuxDriver@microchip.com>,
<lkp@intel.com>
Subject: Re: [PATCH net-next] net: dcb: move getapptrust to separate function
Date: Mon, 14 Nov 2022 08:45:42 +0000 [thread overview]
Message-ID: <Y3ICvKvpiG+Rn+2h@DEN-LT-70577> (raw)
In-Reply-To: <180a55b046e4659609cdfeea4fd979edab17f0c9.camel@perches.com>
> > > > +
> > > > + err = -EMSGSIZE;
> > > > +
> > > > + apptrust = nla_nest_start(skb, DCB_ATTR_DCB_APP_TRUST_TABLE);
> > > > + if (!apptrust)
> > > > + goto nla_put_failure;
> > > > +
> > > > + for (i = 0; i < nselectors; i++) {
> > > > + enum ieee_attrs_app type =
> > > > + dcbnl_app_attr_type_get(selectors[i]);
> > >
> > > Doesn't checkpatch warn about this? There should be a blank line after
> > > the variable declaration block. (Even if there wasn't one there in the
> > > original code either.)
> >
> > Nope, no warning. And I think it has something to do with the way the line
> > is split.
>
> yup.
>
> And style trivia:
>
> I suggest adding error types after specific errors,
> reversing the test and unindenting the code too.
>
> Something like:
>
> err = ops->dcbnl_getapptrust(netdev, selectors, &nselectors);
> if (err) {
> err = 0;
> goto out;
> }
>
> apptrust = nla_nest_start(skb, DCB_ATTR_DCB_APP_TRUST_TABLE);
> if (!apptrust) {
> err = -EMSGSIZE;
> goto out;
> }
>
> for (i = 0; i < nselectors; i++) {
> enum ieee_attrs_app type = dcbnl_app_attr_type_get(selectors[i]);
> err = nla_put_u8(skb, type, selectors[i]);
> if (err) {
> nla_nest_cancel(skb, apptrust);
> goto out;
> }
> }
> nla_nest_end(skb, apptrust);
>
> err = 0;
>
> out:
> kfree(selectors);
> return err;
> }
>
LGTM.
The last err = 0 can even be removed, as I see it.
Will submit a new version with the changes suggested.
/ Daniel
prev parent reply other threads:[~2022-11-14 8:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 9:46 [PATCH net-next] net: dcb: move getapptrust to separate function Daniel Machon
2022-11-10 16:30 ` Petr Machata
2022-11-11 6:45 ` Daniel.Machon
2022-11-11 11:24 ` Petr Machata
2022-11-11 12:47 ` Joe Perches
2022-11-14 8:45 ` Daniel.Machon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y3ICvKvpiG+Rn+2h@DEN-LT-70577 \
--to=daniel.machon@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joe@perches.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox