public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: cgel.zte@gmail.com
Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Changcheng Deng <deng.changcheng@zte.com.cn>,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH] xfs: use swap() to make code cleaner
Date: Tue, 11 Jan 2022 11:10:36 -0800	[thread overview]
Message-ID: <20220111191036.GD656707@magnolia> (raw)
In-Reply-To: <20211028112830.16381-1-deng.changcheng@zte.com.cn>

On Thu, Oct 28, 2021 at 11:28:30AM +0000, cgel.zte@gmail.com wrote:
> From: Changcheng Deng <deng.changcheng@zte.com.cn>
> 
> Use swap() in order to make code cleaner. Issue found by coccinelle.
> 
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>

Odd, I pushed this into 5.16 but never publicly RVB'd it.

Sloppy, Darrick, sloopy...

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_inode.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index a4f6f034fb81..518c82bfc80d 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -564,8 +564,6 @@ xfs_lock_two_inodes(
>  	struct xfs_inode	*ip1,
>  	uint			ip1_mode)
>  {
> -	struct xfs_inode	*temp;
> -	uint			mode_temp;
>  	int			attempts = 0;
>  	struct xfs_log_item	*lp;
>  
> @@ -578,12 +576,8 @@ xfs_lock_two_inodes(
>  	ASSERT(ip0->i_ino != ip1->i_ino);
>  
>  	if (ip0->i_ino > ip1->i_ino) {
> -		temp = ip0;
> -		ip0 = ip1;
> -		ip1 = temp;
> -		mode_temp = ip0_mode;
> -		ip0_mode = ip1_mode;
> -		ip1_mode = mode_temp;
> +		swap(ip0, ip1);
> +		swap(ip0_mode, ip1_mode);
>  	}
>  
>   again:
> -- 
> 2.25.1
> 

  reply	other threads:[~2022-01-11 19:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 11:28 [PATCH] xfs: use swap() to make code cleaner cgel.zte
2022-01-11 19:10 ` Darrick J. Wong [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-11-04  6:24 davidcomponentone

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=20220111191036.GD656707@magnolia \
    --to=djwong@kernel.org \
    --cc=cgel.zte@gmail.com \
    --cc=deng.changcheng@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zealci@zte.com.cn \
    /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