public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Shaokun Zhang <zhangshaokun@hisilicon.com>
To: <linux-xfs@vger.kernel.org>, "Darrick J. Wong" <djwong@kernel.org>
Subject: Re: [PATCH] xfs: remove redundant initialization of variable error
Date: Tue, 8 Jun 2021 09:50:44 +0800	[thread overview]
Message-ID: <ef089c4e-0fa3-733f-e8c1-03d3e9e714d9@hisilicon.com> (raw)
In-Reply-To: <20210607131355.bjdf7lovz5drofrw@omega.lan>

Hi Carlos,

On 2021/6/7 21:13, Carlos Maiolino wrote:
> Hi,
> 
> On Sat, Jun 05, 2021 at 04:52:50PM +0800, Shaokun Zhang wrote:
>> 'error' will be initialized, so clean up the redundant initialization.
>>
>> Cc: "Darrick J. Wong" <djwong@kernel.org>
>> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> 
> 
> This makes no difference in the resulting code.
> Particularly, I'd rather have such variables explicitly initialized. This
> function is small, so it's easy to see its initialization later in the code, but
> still, IMHO, it's way better to see the 'default error values' explicit at the
> beginning of the function. But, it's just my 'visual' preference :)

Thanks your reply, as you also said that it would be assigned later, the
initialization is unnecessary. I'm fine that Darrick will take it or not.

Cheers,
Shaokun

> 
> 
>> ---
>>  fs/xfs/xfs_buf.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
>> index 592800c8852f..59991c8c7127 100644
>> --- a/fs/xfs/xfs_buf.c
>> +++ b/fs/xfs/xfs_buf.c
>> @@ -707,7 +707,7 @@ xfs_buf_get_map(
>>  {
>>  	struct xfs_buf		*bp;
>>  	struct xfs_buf		*new_bp;
>> -	int			error = 0;
>> +	int			error;
>>  
>>  	*bpp = NULL;
>>  	error = xfs_buf_find(target, map, nmaps, flags, NULL, &bp);
>> -- 
>> 2.7.4
>>
> 

  reply	other threads:[~2021-06-08  1:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-05  8:52 [PATCH] xfs: remove redundant initialization of variable error Shaokun Zhang
2021-06-07 13:13 ` Carlos Maiolino
2021-06-08  1:50   ` Shaokun Zhang [this message]
2021-06-12  0:53 ` Darrick J. Wong

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=ef089c4e-0fa3-733f-e8c1-03d3e9e714d9@hisilicon.com \
    --to=zhangshaokun@hisilicon.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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