All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] block: Fine-tuning for five function implementations
@ 2017-01-22  8:30 ` SF Markus Elfring
  0 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:30 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 23:00:00 +0100

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (5):
  Move three assignments for the variable "ret" in tg_set_max()
  Move an assignment for the variable "ret" in tg_set_conf()
  Adjust two function calls together with a variable assignment
  Move an assignment for the variable "ret" in __cfqg_set_weight_device()
  Adjust one function call together with a variable assignment

 block/blk-throttle.c | 34 ++++++++++++++++++++--------------
 block/cfq-iosched.c  | 11 +++++++----
 2 files changed, 27 insertions(+), 18 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 0/5] block: Fine-tuning for five function implementations
@ 2017-01-22  8:30 ` SF Markus Elfring
  0 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:30 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 23:00:00 +0100

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (5):
  Move three assignments for the variable "ret" in tg_set_max()
  Move an assignment for the variable "ret" in tg_set_conf()
  Adjust two function calls together with a variable assignment
  Move an assignment for the variable "ret" in __cfqg_set_weight_device()
  Adjust one function call together with a variable assignment

 block/blk-throttle.c | 34 ++++++++++++++++++++--------------
 block/cfq-iosched.c  | 11 +++++++----
 2 files changed, 27 insertions(+), 18 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
  2017-01-22  8:30 ` SF Markus Elfring
@ 2017-01-22  8:31   ` SF Markus Elfring
  -1 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:31 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

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;
+		}
 
-		ret = -ERANGE;
-		if (!val)
+		if (!val) {
+			ret = -ERANGE;
 			goto out_finish;
+		}
 
-		ret = -EINVAL;
-		if (!strcmp(tok, "rbps"))
+		if (!strcmp(tok, "rbps")) {
 			v[0] = val;
-		else if (!strcmp(tok, "wbps"))
+		} else if (!strcmp(tok, "wbps")) {
 			v[1] = val;
-		else if (!strcmp(tok, "riops"))
+		} else if (!strcmp(tok, "riops")) {
 			v[2] = min_t(u64, val, UINT_MAX);
-		else if (!strcmp(tok, "wiops"))
+		} else if (!strcmp(tok, "wiops")) {
 			v[3] = min_t(u64, val, UINT_MAX);
-		else
+		} else {
+			ret = -EINVAL;
 			goto out_finish;
+		}
 	}
 
 	tg->bps[READ] = v[0];
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
@ 2017-01-22  8:31   ` SF Markus Elfring
  0 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:31 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

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;
+		}
 
-		ret = -ERANGE;
-		if (!val)
+		if (!val) {
+			ret = -ERANGE;
 			goto out_finish;
+		}
 
-		ret = -EINVAL;
-		if (!strcmp(tok, "rbps"))
+		if (!strcmp(tok, "rbps")) {
 			v[0] = val;
-		else if (!strcmp(tok, "wbps"))
+		} else if (!strcmp(tok, "wbps")) {
 			v[1] = val;
-		else if (!strcmp(tok, "riops"))
+		} else if (!strcmp(tok, "riops")) {
 			v[2] = min_t(u64, val, UINT_MAX);
-		else if (!strcmp(tok, "wiops"))
+		} else if (!strcmp(tok, "wiops")) {
 			v[3] = min_t(u64, val, UINT_MAX);
-		else
+		} else {
+			ret = -EINVAL;
 			goto out_finish;
+		}
 	}
 
 	tg->bps[READ] = v[0];
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 2/5] blk-throttle: Move an assignment for the variable "ret" in tg_set_conf()
  2017-01-22  8:30 ` SF Markus Elfring
@ 2017-01-22  8:32   ` SF Markus Elfring
  -1 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:32 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 21:40:38 +0100

A local variable was set to an error code before a concrete error situation
was detected. Thus move the corresponding assignment into an if branch
to indicate a software failure there.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 block/blk-throttle.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 51d112deb02e..b392b48310ba 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1191,9 +1191,10 @@ static ssize_t tg_set_conf(struct kernfs_open_file *of,
 	if (ret)
 		return ret;
 
-	ret = -EINVAL;
-	if (sscanf(ctx.body, "%llu", &v) != 1)
+	if (sscanf(ctx.body, "%llu", &v) != 1) {
+		ret = -EINVAL;
 		goto out_finish;
+	}
 	if (!v)
 		v = -1;
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 2/5] blk-throttle: Move an assignment for the variable "ret" in tg_set_conf()
@ 2017-01-22  8:32   ` SF Markus Elfring
  0 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:32 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 21:40:38 +0100

A local variable was set to an error code before a concrete error situation
was detected. Thus move the corresponding assignment into an if branch
to indicate a software failure there.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 block/blk-throttle.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 51d112deb02e..b392b48310ba 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1191,9 +1191,10 @@ static ssize_t tg_set_conf(struct kernfs_open_file *of,
 	if (ret)
 		return ret;
 
-	ret = -EINVAL;
-	if (sscanf(ctx.body, "%llu", &v) != 1)
+	if (sscanf(ctx.body, "%llu", &v) != 1) {
+		ret = -EINVAL;
 		goto out_finish;
+	}
 	if (!v)
 		v = -1;
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 3/5] blk-throttle: Adjust two function calls together with a variable assignment
  2017-01-22  8:30 ` SF Markus Elfring
@ 2017-01-22  8:33   ` SF Markus Elfring
  -1 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:33 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 22:15:33 +0100

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 block/blk-throttle.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index b392b48310ba..3cf7472fbba2 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -866,10 +866,12 @@ static void tg_update_disptime(struct throtl_grp *tg)
 	unsigned long read_wait = -1, write_wait = -1, min_wait = -1, disptime;
 	struct bio *bio;
 
-	if ((bio = throtl_peek_queued(&sq->queued[READ])))
+	bio = throtl_peek_queued(&sq->queued[READ]);
+	if (bio)
 		tg_may_dispatch(tg, bio, &read_wait);
 
-	if ((bio = throtl_peek_queued(&sq->queued[WRITE])))
+	bio = throtl_peek_queued(&sq->queued[WRITE]);
+	if (bio)
 		tg_may_dispatch(tg, bio, &write_wait);
 
 	min_wait = min(read_wait, write_wait);
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 3/5] blk-throttle: Adjust two function calls together with a variable assignment
@ 2017-01-22  8:33   ` SF Markus Elfring
  0 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:33 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 22:15:33 +0100

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 block/blk-throttle.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index b392b48310ba..3cf7472fbba2 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -866,10 +866,12 @@ static void tg_update_disptime(struct throtl_grp *tg)
 	unsigned long read_wait = -1, write_wait = -1, min_wait = -1, disptime;
 	struct bio *bio;
 
-	if ((bio = throtl_peek_queued(&sq->queued[READ])))
+	bio = throtl_peek_queued(&sq->queued[READ]);
+	if (bio)
 		tg_may_dispatch(tg, bio, &read_wait);
 
-	if ((bio = throtl_peek_queued(&sq->queued[WRITE])))
+	bio = throtl_peek_queued(&sq->queued[WRITE]);
+	if (bio)
 		tg_may_dispatch(tg, bio, &write_wait);
 
 	min_wait = min(read_wait, write_wait);
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 4/5] cfq-iosched: Move an assignment for the variable "ret" in __cfqg_set_weight_device()
  2017-01-22  8:30 ` SF Markus Elfring
@ 2017-01-22  8:34   ` SF Markus Elfring
  -1 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:34 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 22:26:38 +0100

A local variable was set to an error code before a concrete error situation
was detected. Thus move the corresponding assignment into an if branch
to indicate a software failure there.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 block/cfq-iosched.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index c73a6fcaeb9d..454297fe8fd6 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1788,9 +1788,10 @@ static ssize_t __cfqg_set_weight_device(struct kernfs_open_file *of,
 
 	if (sscanf(ctx.body, "%llu", &v) == 1) {
 		/* require "default" on dfl */
-		ret = -ERANGE;
-		if (!v && on_dfl)
+		if (!v && on_dfl) {
+			ret = -ERANGE;
 			goto out_finish;
+		}
 	} else if (!strcmp(strim(ctx.body), "default")) {
 		v = 0;
 	} else {
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 4/5] cfq-iosched: Move an assignment for the variable "ret" in __cfqg_set_weight_device()
@ 2017-01-22  8:34   ` SF Markus Elfring
  0 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:34 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 22:26:38 +0100

A local variable was set to an error code before a concrete error situation
was detected. Thus move the corresponding assignment into an if branch
to indicate a software failure there.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 block/cfq-iosched.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index c73a6fcaeb9d..454297fe8fd6 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1788,9 +1788,10 @@ static ssize_t __cfqg_set_weight_device(struct kernfs_open_file *of,
 
 	if (sscanf(ctx.body, "%llu", &v) = 1) {
 		/* require "default" on dfl */
-		ret = -ERANGE;
-		if (!v && on_dfl)
+		if (!v && on_dfl) {
+			ret = -ERANGE;
 			goto out_finish;
+		}
 	} else if (!strcmp(strim(ctx.body), "default")) {
 		v = 0;
 	} else {
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 5/5] cfq-iosched: Adjust one function call together with a variable assignment
  2017-01-22  8:30 ` SF Markus Elfring
@ 2017-01-22  8:35   ` SF Markus Elfring
  -1 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:35 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 22:44:07 +0100

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 block/cfq-iosched.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 454297fe8fd6..8c405eaa2806 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2750,9 +2750,11 @@ static struct cfq_queue *cfq_get_next_queue_forced(struct cfq_data *cfqd)
 	if (!cfqg)
 		return NULL;
 
-	for_each_cfqg_st(cfqg, i, j, st)
-		if ((cfqq = cfq_rb_first(st)) != NULL)
+	for_each_cfqg_st(cfqg, i, j, st) {
+		cfqq = cfq_rb_first(st);
+		if (cfqq)
 			return cfqq;
+	}
 	return NULL;
 }
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 5/5] cfq-iosched: Adjust one function call together with a variable assignment
@ 2017-01-22  8:35   ` SF Markus Elfring
  0 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-22  8:35 UTC (permalink / raw)
  To: linux-block, Jens Axboe; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 21 Jan 2017 22:44:07 +0100

The script "checkpatch.pl" pointed information out like the following.

ERROR: do not use assignment in if condition

Thus fix the affected source code place.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 block/cfq-iosched.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 454297fe8fd6..8c405eaa2806 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -2750,9 +2750,11 @@ static struct cfq_queue *cfq_get_next_queue_forced(struct cfq_data *cfqd)
 	if (!cfqg)
 		return NULL;
 
-	for_each_cfqg_st(cfqg, i, j, st)
-		if ((cfqq = cfq_rb_first(st)) != NULL)
+	for_each_cfqg_st(cfqg, i, j, st) {
+		cfqq = cfq_rb_first(st);
+		if (cfqq)
 			return cfqq;
+	}
 	return NULL;
 }
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
  2017-01-22  8:31   ` SF Markus Elfring
  (?)
@ 2017-01-23  9:15     ` Johannes Thumshirn
  -1 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:15 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
@ 2017-01-23  9:15     ` Johannes Thumshirn
  0 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:15 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
@ 2017-01-23  9:15     ` Johannes Thumshirn
  0 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:15 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 2/5] blk-throttle: Move an assignment for the variable "ret" in tg_set_conf()
  2017-01-22  8:32   ` SF Markus Elfring
  (?)
@ 2017-01-23  9:16     ` Johannes Thumshirn
  -1 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:16 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Sun, Jan 22, 2017 at 09:32:19AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 21:40:38 +0100
> 
> A local variable was set to an error code before a concrete error situation
> was detected. Thus move the corresponding assignment into an if branch
> to indicate a software failure there.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

See my answer to the last patch.

-- 
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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 2/5] blk-throttle: Move an assignment for the variable "ret" in tg_set_conf()
@ 2017-01-23  9:16     ` Johannes Thumshirn
  0 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:16 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Sun, Jan 22, 2017 at 09:32:19AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 21:40:38 +0100
> 
> A local variable was set to an error code before a concrete error situation
> was detected. Thus move the corresponding assignment into an if branch
> to indicate a software failure there.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

See my answer to the last patch.

-- 
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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 2/5] blk-throttle: Move an assignment for the variable "ret" in tg_set_conf()
@ 2017-01-23  9:16     ` Johannes Thumshirn
  0 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:16 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Sun, Jan 22, 2017 at 09:32:19AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 21:40:38 +0100
> 
> A local variable was set to an error code before a concrete error situation
> was detected. Thus move the corresponding assignment into an if branch
> to indicate a software failure there.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

See my answer to the last patch.

-- 
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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 3/5] blk-throttle: Adjust two function calls together with a variable assignment
  2017-01-22  8:33   ` SF Markus Elfring
  (?)
@ 2017-01-23  9:20     ` Johannes Thumshirn
  -1 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:20 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Sun, Jan 22, 2017 at 09:33:08AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 22:15:33 +0100
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> ERROR: do not use assignment in if condition
> 
> Thus fix the affected source code places.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
if Jens wants doesn't mind.

-- 
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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 3/5] blk-throttle: Adjust two function calls together with a variable assignment
@ 2017-01-23  9:20     ` Johannes Thumshirn
  0 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:20 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Sun, Jan 22, 2017 at 09:33:08AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 22:15:33 +0100
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> ERROR: do not use assignment in if condition
> 
> Thus fix the affected source code places.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
if Jens wants doesn't mind.

-- 
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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 3/5] blk-throttle: Adjust two function calls together with a variable assignment
@ 2017-01-23  9:20     ` Johannes Thumshirn
  0 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:20 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Sun, Jan 22, 2017 at 09:33:08AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 22:15:33 +0100
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> ERROR: do not use assignment in if condition
> 
> Thus fix the affected source code places.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
if Jens wants doesn't mind.

-- 
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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 5/5] cfq-iosched: Adjust one function call together with a variable assignment
  2017-01-22  8:35   ` SF Markus Elfring
  (?)
@ 2017-01-23  9:21     ` Johannes Thumshirn
  -1 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:21 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Sun, Jan 22, 2017 at 09:35:13AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 22:44:07 +0100
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> ERROR: do not use assignment in if condition
> 
> Thus fix the affected source code place.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 5/5] cfq-iosched: Adjust one function call together with a variable assignment
@ 2017-01-23  9:21     ` Johannes Thumshirn
  0 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:21 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Sun, Jan 22, 2017 at 09:35:13AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 22:44:07 +0100
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> ERROR: do not use assignment in if condition
> 
> Thus fix the affected source code place.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 5/5] cfq-iosched: Adjust one function call together with a variable assignment
@ 2017-01-23  9:21     ` Johannes Thumshirn
  0 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23  9:21 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Sun, Jan 22, 2017 at 09:35:13AM +0100, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Jan 2017 22:44:07 +0100
> 
> The script "checkpatch.pl" pointed information out like the following.
> 
> ERROR: do not use assignment in if condition
> 
> Thus fix the affected source code place.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
  2017-01-23  9:15     ` Johannes Thumshirn
@ 2017-01-23 10:00       ` SF Markus Elfring
  -1 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-23 10:00 UTC (permalink / raw)
  To: Johannes Thumshirn, linux-block; +Cc: Jens Axboe, LKML, kernel-janitors

>> @@ -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.

Thanks for your constructive feedback.


> Your patch doesn't introduce a functual change and doesn't improve readability,
> so I don't really see a point for it.

We have got different preferences for the placement of error code settings.
Do you care about run time changes there?

Regards,
Markus

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
@ 2017-01-23 10:00       ` SF Markus Elfring
  0 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-23 10:00 UTC (permalink / raw)
  To: Johannes Thumshirn, linux-block; +Cc: Jens Axboe, LKML, kernel-janitors

>> @@ -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.

Thanks for your constructive feedback.


> Your patch doesn't introduce a functual change and doesn't improve readability,
> so I don't really see a point for it.

We have got different preferences for the placement of error code settings.
Do you care about run time changes there?

Regards,
Markus

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
  2017-01-23 10:00       ` SF Markus Elfring
  (?)
@ 2017-01-23 11:47         ` Johannes Thumshirn
  -1 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23 11:47 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Mon, Jan 23, 2017 at 11:00:15AM +0100, SF Markus Elfring wrote:
> >> @@ -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.
> 
> Thanks for your constructive feedback.
> 
> 
> > Your patch doesn't introduce a functual change and doesn't improve readability,
> > so I don't really see a point for it.
> 
> We have got different preferences for the placement of error code settings.
Yes we do, so what's the point? Both are OK. Please don't go down that road it
opens so much potential for needless bikeshedding and waste all of our
(including your) time.

Thanks,
	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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
@ 2017-01-23 11:47         ` Johannes Thumshirn
  0 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23 11:47 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Mon, Jan 23, 2017 at 11:00:15AM +0100, SF Markus Elfring wrote:
> >> @@ -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.
> 
> Thanks for your constructive feedback.
> 
> 
> > Your patch doesn't introduce a functual change and doesn't improve readability,
> > so I don't really see a point for it.
> 
> We have got different preferences for the placement of error code settings.
Yes we do, so what's the point? Both are OK. Please don't go down that road it
opens so much potential for needless bikeshedding and waste all of our
(including your) time.

Thanks,
	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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
@ 2017-01-23 11:47         ` Johannes Thumshirn
  0 siblings, 0 replies; 35+ messages in thread
From: Johannes Thumshirn @ 2017-01-23 11:47 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: linux-block, Jens Axboe, LKML, kernel-janitors

On Mon, Jan 23, 2017 at 11:00:15AM +0100, SF Markus Elfring wrote:
> >> @@ -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.
> 
> Thanks for your constructive feedback.
> 
> 
> > Your patch doesn't introduce a functual change and doesn't improve readability,
> > so I don't really see a point for it.
> 
> We have got different preferences for the placement of error code settings.
Yes we do, so what's the point? Both are OK. Please don't go down that road it
opens so much potential for needless bikeshedding and waste all of our
(including your) time.

Thanks,
	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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
  2017-01-23 11:47         ` Johannes Thumshirn
@ 2017-01-23 12:06           ` SF Markus Elfring
  -1 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-23 12:06 UTC (permalink / raw)
  To: Johannes Thumshirn, linux-block; +Cc: Jens Axboe, LKML, kernel-janitors

>> We have got different preferences for the placement of error code settings.
> Yes we do, so what's the point? Both are OK.

Can a function implementation be executed a bit faster in the case
that error codes will usually only matter if they would be set after
a concrete software failure


> Please don't go down that road it opens so much potential for needless bikeshedding
> and waste all of our (including your) time.

I would appreciate to clarify involved run time consequences a bit more.

Regards,
Markus

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
@ 2017-01-23 12:06           ` SF Markus Elfring
  0 siblings, 0 replies; 35+ messages in thread
From: SF Markus Elfring @ 2017-01-23 12:06 UTC (permalink / raw)
  To: Johannes Thumshirn, linux-block; +Cc: Jens Axboe, LKML, kernel-janitors

>> We have got different preferences for the placement of error code settings.
> Yes we do, so what's the point? Both are OK.

Can a function implementation be executed a bit faster in the case
that error codes will usually only matter if they would be set after
a concrete software failure


> Please don't go down that road it opens so much potential for needless bikeshedding
> and waste all of our (including your) time.

I would appreciate to clarify involved run time consequences a bit more.

Regards,
Markus

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 3/5] blk-throttle: Adjust two function calls together with a variable assignment
  2017-01-23  9:20     ` Johannes Thumshirn
@ 2017-01-23 15:14       ` Jens Axboe
  -1 siblings, 0 replies; 35+ messages in thread
From: Jens Axboe @ 2017-01-23 15:14 UTC (permalink / raw)
  To: Johannes Thumshirn, SF Markus Elfring; +Cc: linux-block, LKML, kernel-janitors

On 01/23/2017 02:20 AM, Johannes Thumshirn wrote:
> On Sun, Jan 22, 2017 at 09:33:08AM +0100, SF Markus Elfring wrote:
>> From: Markus Elfring <elfring@users.sourceforge.net>
>> Date: Sat, 21 Jan 2017 22:15:33 +0100
>>
>> The script "checkpatch.pl" pointed information out like the following.
>>
>> ERROR: do not use assignment in if condition
>>
>> Thus fix the affected source code places.
>>
>> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
>> ---
> 
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> if Jens wants doesn't mind.

I don't mind these, but I completely agree on the patches for moving the
'error' assignment. What ends up happening for those cases is that
someone adds a new section and forgets to set 'error', and then all hell
breaks lose.

So Markus, don't bother sending those patches again for the block layer
or drivers, I'm not going to take them.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 3/5] blk-throttle: Adjust two function calls together with a variable assignment
@ 2017-01-23 15:14       ` Jens Axboe
  0 siblings, 0 replies; 35+ messages in thread
From: Jens Axboe @ 2017-01-23 15:14 UTC (permalink / raw)
  To: Johannes Thumshirn, SF Markus Elfring; +Cc: linux-block, LKML, kernel-janitors

On 01/23/2017 02:20 AM, Johannes Thumshirn wrote:
> On Sun, Jan 22, 2017 at 09:33:08AM +0100, SF Markus Elfring wrote:
>> From: Markus Elfring <elfring@users.sourceforge.net>
>> Date: Sat, 21 Jan 2017 22:15:33 +0100
>>
>> The script "checkpatch.pl" pointed information out like the following.
>>
>> ERROR: do not use assignment in if condition
>>
>> Thus fix the affected source code places.
>>
>> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
>> ---
> 
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> if Jens wants doesn't mind.

I don't mind these, but I completely agree on the patches for moving the
'error' assignment. What ends up happening for those cases is that
someone adds a new section and forgets to set 'error', and then all hell
breaks lose.

So Markus, don't bother sending those patches again for the block layer
or drivers, I'm not going to take them.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
  2017-01-23 12:06           ` SF Markus Elfring
@ 2017-01-23 15:17             ` Jens Axboe
  -1 siblings, 0 replies; 35+ messages in thread
From: Jens Axboe @ 2017-01-23 15:17 UTC (permalink / raw)
  To: SF Markus Elfring, Johannes Thumshirn, linux-block; +Cc: LKML, kernel-janitors

On 01/23/2017 05:06 AM, SF Markus Elfring wrote:
>>> We have got different preferences for the placement of error code settings.
>> Yes we do, so what's the point? Both are OK.
> 
> Can a function implementation be executed a bit faster in the case
> that error codes will usually only matter if they would be set after
> a concrete software failure

Don't turn this into a troll fest. Maintainability trumps performance.
Every time. See previous email for reasoning for that.

>> Please don't go down that road it opens so much potential for needless bikeshedding
>> and waste all of our (including your) time.
> 
> I would appreciate to clarify involved run time consequences a bit more.

How about you go and benchmark the before and after, and present some
compelling evidence based on those tests for why the change should be
made? The onus is on the submitter here, not the reviewer.

As I said in the previous email, don't bother sending these types of
patches for the block layer again. They are just going to be ignored.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: blk-throttle: Move three assignments for the variable "ret" in tg_set_max()
@ 2017-01-23 15:17             ` Jens Axboe
  0 siblings, 0 replies; 35+ messages in thread
From: Jens Axboe @ 2017-01-23 15:17 UTC (permalink / raw)
  To: SF Markus Elfring, Johannes Thumshirn, linux-block; +Cc: LKML, kernel-janitors

On 01/23/2017 05:06 AM, SF Markus Elfring wrote:
>>> We have got different preferences for the placement of error code settings.
>> Yes we do, so what's the point? Both are OK.
> 
> Can a function implementation be executed a bit faster in the case
> that error codes will usually only matter if they would be set after
> a concrete software failure

Don't turn this into a troll fest. Maintainability trumps performance.
Every time. See previous email for reasoning for that.

>> Please don't go down that road it opens so much potential for needless bikeshedding
>> and waste all of our (including your) time.
> 
> I would appreciate to clarify involved run time consequences a bit more.

How about you go and benchmark the before and after, and present some
compelling evidence based on those tests for why the change should be
made? The onus is on the submitter here, not the reviewer.

As I said in the previous email, don't bother sending these types of
patches for the block layer again. They are just going to be ignored.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2017-01-23 15:17 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.