From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Oliver Hartkopp <socketcan@hartkopp.net>,
linux-can@vger.kernel.org, netdev@vger.kernel.org
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
Wolfgang Grandegger <wg@grandegger.com>,
LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] can: Use common error handling code in vxcan_newlink()
Date: Sat, 28 Oct 2017 10:23:02 +0200 [thread overview]
Message-ID: <d3bdd3c0-5a03-dd59-07ca-94b126c67f75@users.sourceforge.net> (raw)
In-Reply-To: <2ab5d794-7a5c-9036-835c-67cfcc541795@hartkopp.net>
>> @@ -227,10 +227,8 @@ static int vxcan_newlink(struct net *net, struct net_device *dev,
>> netif_carrier_off(peer);
>> err = rtnl_configure_link(peer, ifmp);
>> - if (err < 0) {
>> - unregister_netdevice(peer);
>> - return err;
>> - }
>> + if (err)
>> + goto unregister_network_device;
>
> You are changing semantic in the if-statement here.
I got an other software development opinion for this implementation detail.
http://elixir.free-electrons.com/linux/v4.14-rc6/source/net/core/rtnetlink.c#L2393
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/net/core/rtnetlink.c?id=36ef71cae353f88fd6e095e2aaa3e5953af1685d#n2513
The success predicate for the function “rtnl_configure_link” is that
the return value is zero. I would prefer to treat other values as
an error code then.
> I would be fine with the patch
Thanks for a bit of change acceptance.
> if you revert that if-statement as I would like to stay on the behavior
> from veth.c in veth_newlink().
Will another bit of clarification be useful around the usage of error predicates?
Regards,
Markus
next prev parent reply other threads:[~2017-10-28 8:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-27 20:30 [PATCH] can: Use common error handling code in vxcan_newlink() SF Markus Elfring
2017-10-28 6:48 ` Oliver Hartkopp
2017-10-28 8:23 ` SF Markus Elfring [this message]
2017-10-28 17:40 ` Oliver Hartkopp
2017-10-28 18:33 ` SF Markus Elfring
2017-10-28 19:04 ` Oliver Hartkopp
2017-10-28 19:18 ` SF Markus Elfring
2017-10-28 19:54 ` Oliver Hartkopp
2017-10-28 20:13 ` SF Markus Elfring
2017-10-29 10:51 ` Oliver Hartkopp
2017-11-01 14:16 ` [PATCH v2] " SF Markus Elfring
2017-11-01 19:09 ` Oliver Hartkopp
2017-11-01 19:37 ` [v2] " SF Markus Elfring
2017-11-02 8:22 ` Oliver Hartkopp
2017-11-07 8:21 ` [PATCH v2] " Marc Kleine-Budde
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=d3bdd3c0-5a03-dd59-07ca-94b126c67f75@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=socketcan@hartkopp.net \
--cc=wg@grandegger.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;
as well as URLs for NNTP newsgroup(s).