All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
Date: Mon, 23 Jan 2017 09:15:11 +0000	[thread overview]
Message-ID: <20170123091510.GA3517@linux-x5ow.site> (raw)
In-Reply-To: <75495d45-cfc4-9740-39e4-bd4c3e71232b@users.sourceforge.net>

On Sun, Jan 22, 2017 at 09:31:29AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 21:23:06 +0100
> 
> A local variable was set to an error code before a concrete error situation
> was detected. Thus move the corresponding assignments into if branches
> to indicate a software failure there.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  block/blk-throttle.c | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/block/blk-throttle.c b/block/blk-throttle.c
> index 6f4c96e5f86b..51d112deb02e 100644
> --- a/block/blk-throttle.c
> +++ b/block/blk-throttle.c
> @@ -1327,27 +1327,30 @@ static ssize_t tg_set_max(struct kernfs_open_file *of,
>  			break;
>  		ctx.body += len;
>  
> -		ret = -EINVAL;
>  		p = tok;
>  		strsep(&p, "=");
> -		if (!p || (sscanf(p, "%llu", &val) != 1 && strcmp(p, "max")))
> +		if (!p || (sscanf(p, "%llu", &val) != 1 && strcmp(p, "max"))) {
> +			ret = -EINVAL;
>  			goto out_finish;
> +		}

Sorry, I don't like this patch. We know the next error if we encounter one
will be EINVAL until we change it. Your patch doesn't introduce a functual
change and doesn't improve readability, so I don't really see a point for it.

Byte,
	Johannes

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Johannes Thumshirn <jthumshirn@suse.de>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
Date: Mon, 23 Jan 2017 10:15:11 +0100	[thread overview]
Message-ID: <20170123091510.GA3517@linux-x5ow.site> (raw)
In-Reply-To: <75495d45-cfc4-9740-39e4-bd4c3e71232b@users.sourceforge.net>

On Sun, Jan 22, 2017 at 09:31:29AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 21:23:06 +0100
> 
> A local variable was set to an error code before a concrete error situation
> was detected. Thus move the corresponding assignments into if branches
> to indicate a software failure there.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  block/blk-throttle.c | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/block/blk-throttle.c b/block/blk-throttle.c
> index 6f4c96e5f86b..51d112deb02e 100644
> --- a/block/blk-throttle.c
> +++ b/block/blk-throttle.c
> @@ -1327,27 +1327,30 @@ static ssize_t tg_set_max(struct kernfs_open_file *of,
>  			break;
>  		ctx.body += len;
>  
> -		ret = -EINVAL;
>  		p = tok;
>  		strsep(&p, "=");
> -		if (!p || (sscanf(p, "%llu", &val) != 1 && strcmp(p, "max")))
> +		if (!p || (sscanf(p, "%llu", &val) != 1 && strcmp(p, "max"))) {
> +			ret = -EINVAL;
>  			goto out_finish;
> +		}

Sorry, I don't like this patch. We know the next error if we encounter one
will be EINVAL until we change it. Your patch doesn't introduce a functual
change and doesn't improve readability, so I don't really see a point for it.

Byte,
	Johannes

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: Felix Imend�rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N�rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

WARNING: multiple messages have this Message-ID (diff)
From: Johannes Thumshirn <jthumshirn@suse.de>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
Date: Mon, 23 Jan 2017 10:15:11 +0100	[thread overview]
Message-ID: <20170123091510.GA3517@linux-x5ow.site> (raw)
In-Reply-To: <75495d45-cfc4-9740-39e4-bd4c3e71232b@users.sourceforge.net>

On Sun, Jan 22, 2017 at 09:31:29AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 21:23:06 +0100
> 
> A local variable was set to an error code before a concrete error situation
> was detected. Thus move the corresponding assignments into if branches
> to indicate a software failure there.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  block/blk-throttle.c | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/block/blk-throttle.c b/block/blk-throttle.c
> index 6f4c96e5f86b..51d112deb02e 100644
> --- a/block/blk-throttle.c
> +++ b/block/blk-throttle.c
> @@ -1327,27 +1327,30 @@ static ssize_t tg_set_max(struct kernfs_open_file *of,
>  			break;
>  		ctx.body += len;
>  
> -		ret = -EINVAL;
>  		p = tok;
>  		strsep(&p, "=");
> -		if (!p || (sscanf(p, "%llu", &val) != 1 && strcmp(p, "max")))
> +		if (!p || (sscanf(p, "%llu", &val) != 1 && strcmp(p, "max"))) {
> +			ret = -EINVAL;
>  			goto out_finish;
> +		}

Sorry, I don't like this patch. We know the next error if we encounter one
will be EINVAL until we change it. Your patch doesn't introduce a functual
change and doesn't improve readability, so I don't really see a point for it.

Byte,
	Johannes

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

  reply	other threads:[~2017-01-23  9:15 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-22  8:30 [PATCH 0/5] block: Fine-tuning for five function implementations SF Markus Elfring
2017-01-22  8:30 ` SF Markus Elfring
2017-01-22  8:31 ` [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max() SF Markus Elfring
2017-01-22  8:31   ` SF Markus Elfring
2017-01-23  9:15   ` Johannes Thumshirn [this message]
2017-01-23  9:15     ` Johannes Thumshirn
2017-01-23  9:15     ` Johannes Thumshirn
2017-01-23 10:00     ` SF Markus Elfring
2017-01-23 10:00       ` SF Markus Elfring
2017-01-23 11:47       ` Johannes Thumshirn
2017-01-23 11:47         ` Johannes Thumshirn
2017-01-23 11:47         ` Johannes Thumshirn
2017-01-23 12:06         ` SF Markus Elfring
2017-01-23 12:06           ` SF Markus Elfring
2017-01-23 15:17           ` Jens Axboe
2017-01-23 15:17             ` Jens Axboe
2017-01-22  8:32 ` [PATCH 2/5] blk-throttle: Move an assignment for the variable "ret" in tg_set_conf() SF Markus Elfring
2017-01-22  8:32   ` SF Markus Elfring
2017-01-23  9:16   ` Johannes Thumshirn
2017-01-23  9:16     ` Johannes Thumshirn
2017-01-23  9:16     ` Johannes Thumshirn
2017-01-22  8:33 ` [PATCH 3/5] blk-throttle: Adjust two function calls together with a variable assignment SF Markus Elfring
2017-01-22  8:33   ` SF Markus Elfring
2017-01-23  9:20   ` Johannes Thumshirn
2017-01-23  9:20     ` Johannes Thumshirn
2017-01-23  9:20     ` Johannes Thumshirn
2017-01-23 15:14     ` Jens Axboe
2017-01-23 15:14       ` Jens Axboe
2017-01-22  8:34 ` [PATCH 4/5] cfq-iosched: Move an assignment for the variable "ret" in __cfqg_set_weight_device() SF Markus Elfring
2017-01-22  8:34   ` SF Markus Elfring
2017-01-22  8:35 ` [PATCH 5/5] cfq-iosched: Adjust one function call together with a variable assignment SF Markus Elfring
2017-01-22  8:35   ` SF Markus Elfring
2017-01-23  9:21   ` Johannes Thumshirn
2017-01-23  9:21     ` Johannes Thumshirn
2017-01-23  9:21     ` Johannes Thumshirn

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=20170123091510.GA3517@linux-x5ow.site \
    --to=jthumshirn@suse.de \
    --cc=axboe@kernel.dk \
    --cc=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-block@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.