Netdev List
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Huazhong Tan <tanhuazhong@huawei.com>, davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	salil.mehta@huawei.com, yisen.zhuang@huawei.com,
	linuxarm@huawei.com, jakub.kicinski@netronome.com,
	Peng Li <lipeng321@huawei.com>
Subject: Re: [PATCH net-next 4/7] net: hns3: add client node validity judgment
Date: Thu, 5 Sep 2019 13:12:51 +0300	[thread overview]
Message-ID: <b0aa6da6-cd42-dd31-8ff7-ca3f48de58ff@cogentembedded.com> (raw)
In-Reply-To: <1567606006-39598-5-git-send-email-tanhuazhong@huawei.com>

On 04.09.2019 17:06, Huazhong Tan wrote:

> From: Peng Li <lipeng321@huawei.com>
> 
> HNS3 driver can only unregister client which included in hnae3_client_list.
> This patch adds the client node validity judgment.
> 
> Signed-off-by: Peng Li <lipeng321@huawei.com>
> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
> ---
>   drivers/net/ethernet/hisilicon/hns3/hnae3.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.c b/drivers/net/ethernet/hisilicon/hns3/hnae3.c
> index 528f624..6aa5257 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.c
> @@ -138,12 +138,28 @@ EXPORT_SYMBOL(hnae3_register_client);
>   
>   void hnae3_unregister_client(struct hnae3_client *client)
>   {
> +	struct hnae3_client *client_tmp;
>   	struct hnae3_ae_dev *ae_dev;
> +	bool existed = false;
>   
>   	if (!client)
>   		return;
>   
>   	mutex_lock(&hnae3_common_lock);
> +
> +	list_for_each_entry(client_tmp, &hnae3_client_list, node) {
> +		if (client_tmp->type == client->type) {
> +			existed = true;
> +			break;
> +		}
> +	}
> +
> +	if (!existed) {
> +		mutex_unlock(&hnae3_common_lock);
> +		pr_err("client %s not existed!\n", client->name);

    Did not exist, you mean?

[...]

MBR, Sergei

  reply	other threads:[~2019-09-05 10:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 14:06 [PATCH net-next 0/7] net: hns3: add some bugfixes and cleanups Huazhong Tan
2019-09-04 14:06 ` [PATCH net-next 1/7] net: hns3: fix error VF index when setting VLAN offload Huazhong Tan
2019-09-04 14:06 ` [PATCH net-next 2/7] net: hns3: fix double free bug when setting ringparam Huazhong Tan
2019-09-04 14:06 ` [PATCH net-next 3/7] net: hns3: fix mis-assignment to hdev->reset_level in hclge_reset Huazhong Tan
2019-09-04 14:06 ` [PATCH net-next 4/7] net: hns3: add client node validity judgment Huazhong Tan
2019-09-05 10:12   ` Sergei Shtylyov [this message]
2019-09-05 11:01     ` tanhuazhong
2019-09-04 14:06 ` [PATCH net-next 5/7] net: hns3: remove explicit conversion to bool Huazhong Tan
2019-09-04 14:06 ` [PATCH net-next 6/7] net: hns3: disable loopback setting in hclge_mac_init Huazhong Tan
2019-09-04 14:06 ` [PATCH net-next 7/7] net: hns3: make hclge_dbg_get_m7_stats_info static Huazhong Tan

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=b0aa6da6-cd42-dd31-8ff7-ca3f48de58ff@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=tanhuazhong@huawei.com \
    --cc=yisen.zhuang@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