mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Florian Schmaus <flo@geekplace.eu>,
	Kent Overstreet <kent.overstreet@gmail.com>,
	linux-bcache@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] bcache: do not assign in if condition in bcache_device_init()
Date: Mon, 18 Jun 2018 21:45:53 +0800	[thread overview]
Message-ID: <79b31a5a-ef33-2f4e-6dfd-38c67304ded8@suse.de> (raw)
In-Reply-To: <20180618100902.4015-4-flo@geekplace.eu>

On 2018/6/18 6:09 PM, Florian Schmaus wrote:
> Fixes an error condition reported by checkpatch.pl which is caused by
> assigning a variable in an if condition.
> 
> Signed-off-by: Florian Schmaus <flo@geekplace.eu>
> ---
>  drivers/md/bcache/super.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index f09f4f046315..4a2a028c8754 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -796,11 +796,12 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size,
>  		return idx;
>  
>  	if (bioset_init(&d->bio_split, 4, offsetof(struct bbio, bio),
> -			BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER) ||
> -	    !(d->disk = alloc_disk(BCACHE_MINORS))) {
> -		ida_simple_remove(&bcache_device_idx, idx);
> -		return -ENOMEM;
> -	}
> +				BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER))

Signed-off-by: Coly Li <colyli@suse.de>
I fix the above indent and added the patch into for-next patch set. Thanks.

Coly Li

> +		goto err;
> +
> +	d->disk = alloc_disk(BCACHE_MINORS);
> +	if (!d->disk)
> +		goto err;
>  
>  	set_capacity(d->disk, sectors);
>  	snprintf(d->disk->disk_name, DISK_NAME_LEN, "bcache%i", idx);
> @@ -834,6 +835,11 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size,
>  	blk_queue_write_cache(q, true, true);
>  
>  	return 0;
> +
> +err:
> +	ida_simple_remove(&bcache_device_idx, idx);
> +	return -ENOMEM;
> +
>  }
>  
>  /* Cached device */
> 


      reply	other threads:[~2018-06-18 13:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 10:08 [PATCH 0/3] bcache: Fix variable assignment in if condition in super.c Florian Schmaus
2018-06-18 10:09 ` [PATCH 1/3] bcache: do not assign in if condition register_bcache() Florian Schmaus
2018-06-18 13:44   ` Coly Li
2018-06-18 10:09 ` [PATCH 2/3] bcache: do not assign in if condition in bcache_init() Florian Schmaus
2018-06-18 13:44   ` Coly Li
2018-06-18 10:09 ` [PATCH 3/3] bcache: do not assign in if condition in bcache_device_init() Florian Schmaus
2018-06-18 13:45   ` Coly Li [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=79b31a5a-ef33-2f4e-6dfd-38c67304ded8@suse.de \
    --to=colyli@suse.de \
    --cc=flo@geekplace.eu \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®