[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <08fd31d5-8677-81e7-65d6-40d501017db6@hartkopp.net>
Date: Wed, 1 Nov 2017 20:09:31 +0100
From: Oliver Hartkopp <socketcan@...tkopp.net>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>,
Marc Kleine-Budde <mkl@...gutronix.de>,
Wolfgang Grandegger <wg@...ndegger.com>,
linux-can@...r.kernel.org,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH v2] can: Use common error handling code in vxcan_newlink()
On 11/01/2017 03:16 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Wed, 1 Nov 2017 14:56:15 +0100
>
> Add a jump target so that a bit of exception handling can be better reused
> at the end of this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
Acked-by: Oliver Hartkopp <socketcan@...tkopp.net>
Again: Posting such a patch on linux-can@...r.kernel.org is ENOUGH!
No need to cross post such a patch additionally on
netdev@...r.kernel.org
linux-kernel@...r.kernel.org
kernel-janitors@...r.kernel.org
and to each of the maintainers
mkl@...gutronix.de
wg@...ndegger.com
socketcan@...tkopp.net
We all subscribed the mailing list and listen to it.
That's the intention of a mailing list ...
Cross posting is not appreciated in the community.
Thanks,
Oliver
> ---
>
> v2:
> An approach to make two checks for a failure predicate a bit safer
> was rejected on 2017-10-28.
> The possibility remains to reconsider such an adjustment later again.
> https://lkml.org/lkml/2017/10/28/125
> https://lkml.kernel.org/r/<264b3c2b-8354-5769-639c-ac8d2fcbe630@...tkopp.net>
>
> drivers/net/can/vxcan.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/can/vxcan.c b/drivers/net/can/vxcan.c
> index 8404e8852a0f..5d1753cfacea 100644
> --- a/drivers/net/can/vxcan.c
> +++ b/drivers/net/can/vxcan.c
> @@ -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 < 0)
> + goto unregister_network_device;
>
> /* register first device */
> if (tb[IFLA_IFNAME])
> @@ -239,10 +237,8 @@ static int vxcan_newlink(struct net *net, struct net_device *dev,
> snprintf(dev->name, IFNAMSIZ, DRV_NAME "%%d");
>
> err = register_netdevice(dev);
> - if (err < 0) {
> - unregister_netdevice(peer);
> - return err;
> - }
> + if (err < 0)
> + goto unregister_network_device;
>
> netif_carrier_off(dev);
>
> @@ -254,6 +250,10 @@ static int vxcan_newlink(struct net *net, struct net_device *dev,
> rcu_assign_pointer(priv->peer, dev);
>
> return 0;
> +
> +unregister_network_device:
> + unregister_netdevice(peer);
> + return err;
> }
>
> static void vxcan_dellink(struct net_device *dev, struct list_head *head)
>
Powered by blists - more mailing lists