[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMZ6RqJNXr9S83o_YgofXsTh7pqtP9iGy_kTrgL69F=_BNqu2A@mail.gmail.com>
Date: Mon, 14 Nov 2022 14:14:36 +0900
From: Vincent MAILHOL <mailhol.vincent@...adoo.fr>
To: Zhang Changzhong <zhangchangzhong@...wei.com>
Cc: Wolfgang Grandegger <wg@...ndegger.com>,
Marc Kleine-Budde <mkl@...gutronix.de>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Arunachalam Santhanam <arunachalam.santhanam@...bosch.com>,
linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] can: etas_es58x: free netdev when register_candev()
failed in es58x_init_netdev()
Hi Zhang,
Thank you for the patch.
On Mon. 14 nov. 2022 at 12:13, Zhang Changzhong
<zhangchangzhong@...wei.com> wrote:
> In case of register_candev() fails, clear es58x_dev->netdev[channel_idx]
> and add free_candev(). Otherwise es58x_free_netdevs() will unregister
> the netdev that has never been registered.
>
> Fixes: 1dfb6005a60b ("can: etas_es58x: add support for ETAS ES581.4 CAN USB interface")
Nitpick, the correct fix tag is:
Fixes: 8537257874e9 ("can: etas_es58x: add core support for ETAS ES58X
CAN USB interfaces")
Aside of that,
Acked-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
> Signed-off-by: Zhang Changzhong <zhangchangzhong@...wei.com>
> ---
> drivers/net/can/usb/etas_es58x/es58x_core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/can/usb/etas_es58x/es58x_core.c b/drivers/net/can/usb/etas_es58x/es58x_core.c
> index 25f863b..ddb7c57 100644
> --- a/drivers/net/can/usb/etas_es58x/es58x_core.c
> +++ b/drivers/net/can/usb/etas_es58x/es58x_core.c
> @@ -2091,8 +2091,11 @@ static int es58x_init_netdev(struct es58x_device *es58x_dev, int channel_idx)
> netdev->dev_port = channel_idx;
>
> ret = register_candev(netdev);
> - if (ret)
> + if (ret) {
> + es58x_dev->netdev[channel_idx] = NULL;
> + free_candev(netdev);
> return ret;
> + }
>
> netdev_queue_set_dql_min_limit(netdev_get_tx_queue(netdev, 0),
> es58x_dev->param->dql_min_limit);
> --
> 2.9.5
>
Powered by blists - more mailing lists