netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Yuan Can <yuancan@huawei.com>,
	jdmason@kudzu.us, allenbh@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	nab@linux-iscsi.org, gregkh@linuxfoundation.org,
	ntb@lists.linux.dev, netdev@vger.kernel.org
Subject: Re: [PATCH] net: net_netdev: Fix error handling in ntb_netdev_init_module()
Date: Mon, 28 Nov 2022 08:38:23 -0700	[thread overview]
Message-ID: <dd693036-961a-ea1d-3bad-378222430dc9@intel.com> (raw)
In-Reply-To: <20221124070917.38825-1-yuancan@huawei.com>



On 11/24/2022 12:09 AM, Yuan Can wrote:
> The ntb_netdev_init_module() returns the ntb_transport_register_client()
> directly without checking its return value, if
> ntb_transport_register_client() failed, the NTB client device is not
> unregistered.
> 
> Fix by unregister NTB client device when ntb_transport_register_client()
> failed.
> 
> Fixes: 548c237c0a99 ("net: Add support for NTB virtual ethernet device")
> Signed-off-by: Yuan Can <yuancan@huawei.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>   drivers/net/ntb_netdev.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ntb_netdev.c b/drivers/net/ntb_netdev.c
> index 464d88ca8ab0..a4abea921046 100644
> --- a/drivers/net/ntb_netdev.c
> +++ b/drivers/net/ntb_netdev.c
> @@ -484,7 +484,14 @@ static int __init ntb_netdev_init_module(void)
>   	rc = ntb_transport_register_client_dev(KBUILD_MODNAME);
>   	if (rc)
>   		return rc;
> -	return ntb_transport_register_client(&ntb_netdev_client);
> +
> +	rc = ntb_transport_register_client(&ntb_netdev_client);
> +	if (rc) {
> +		ntb_transport_unregister_client_dev(KBUILD_MODNAME);
> +		return rc;
> +	}
> +
> +	return 0;
>   }
>   module_init(ntb_netdev_init_module);
>   

      parent reply	other threads:[~2022-11-28 15:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24  7:09 [PATCH] net: net_netdev: Fix error handling in ntb_netdev_init_module() Yuan Can
2022-11-28 11:10 ` patchwork-bot+netdevbpf
2022-11-28 15:38 ` Dave Jiang [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=dd693036-961a-ea1d-3bad-378222430dc9@intel.com \
    --to=dave.jiang@intel.com \
    --cc=allenbh@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jdmason@kudzu.us \
    --cc=kuba@kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=netdev@vger.kernel.org \
    --cc=ntb@lists.linux.dev \
    --cc=pabeni@redhat.com \
    --cc=yuancan@huawei.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).