netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Hui Su <sh_def@163.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net/atm: use list_is_singular() in br2684_setfilt()
Date: Tue, 27 Oct 2020 17:47:18 -0700	[thread overview]
Message-ID: <20201027174718.51889f52@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20201026165700.GA8218@rlk>

On Tue, 27 Oct 2020 00:57:00 +0800 Hui Su wrote:
> list_is_singular() can tell whether a list has just one entry.
> So we use list_is_singular() here.
> 
> Signed-off-by: Hui Su <sh_def@163.com>
> ---
>  net/atm/br2684.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/atm/br2684.c b/net/atm/br2684.c
> index 3e17a5ecaa94..398f7e086cf4 100644
> --- a/net/atm/br2684.c
> +++ b/net/atm/br2684.c
> @@ -372,8 +372,7 @@ static int br2684_setfilt(struct atm_vcc *atmvcc, void __user * arg)
>  		struct br2684_dev *brdev;
>  		read_lock(&devs_lock);
>  		brdev = BRPRIV(br2684_find_dev(&fs.ifspec));
> -		if (brdev == NULL || list_empty(&brdev->brvccs) ||
> -		    brdev->brvccs.next != brdev->brvccs.prev)	/* >1 VCC */
> +		if (brdev == NULL || !list_is_singular(&brdev->brvccs))	/* >1 VCC */

You can drop the /* >1 VCC */ comment now, the code is clear enough

>  			brvcc = NULL;
>  		else
>  			brvcc = list_entry_brvcc(brdev->brvccs.next);


      reply	other threads:[~2020-10-29  0:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 16:57 [PATCH] net/atm: use list_is_singular() in br2684_setfilt() Hui Su
2020-10-28  0:47 ` Jakub Kicinski [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=20201027174718.51889f52@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sh_def@163.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).