Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1634450 > unrolled thread

[PATCH 5/6] md: Adjust six function calls together with a variable assignment in faulty_status()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2017-05-02 16:30 +0200
Last post2017-05-02 16:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 5/6] md: Adjust six function calls together with a variable  assignment in faulty_status() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-02 16:30 +0200

#1634450 — [PATCH 5/6] md: Adjust six function calls together with a variable assignment in faulty_status()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2017-05-02 16:30 +0200
Subject[PATCH 5/6] md: Adjust six function calls together with a variable assignment in faulty_status()
Message-ID<tCGYp-7Na-7@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 2 May 2017 15:35:35 +0200

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>
---
 drivers/md/faulty.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c
index f5536c91be5c..2573009b1265 100644
--- a/drivers/md/faulty.c
+++ b/drivers/md/faulty.c
@@ -231,28 +231,33 @@ static void faulty_status(struct seq_file *seq, struct mddev *mddev)
 	struct faulty_conf *conf = mddev->private;
 	int n;
 
-	if ((n=atomic_read(&conf->counters[WriteTransient])) != 0)
+	n = atomic_read(&conf->counters[WriteTransient]);
+	if (n != 0)
 		seq_printf(seq, " WriteTransient=%d(%d)",
 			   n, conf->period[WriteTransient]);
 
-	if ((n=atomic_read(&conf->counters[ReadTransient])) != 0)
+	n = atomic_read(&conf->counters[ReadTransient]);
+	if (n != 0)
 		seq_printf(seq, " ReadTransient=%d(%d)",
 			   n, conf->period[ReadTransient]);
 
-	if ((n=atomic_read(&conf->counters[WritePersistent])) != 0)
+	n = atomic_read(&conf->counters[WritePersistent]);
+	if (n != 0)
 		seq_printf(seq, " WritePersistent=%d(%d)",
 			   n, conf->period[WritePersistent]);
 
-	if ((n=atomic_read(&conf->counters[ReadPersistent])) != 0)
+	n = atomic_read(&conf->counters[ReadPersistent]);
+	if (n != 0)
 		seq_printf(seq, " ReadPersistent=%d(%d)",
 			   n, conf->period[ReadPersistent]);
 
-
-	if ((n=atomic_read(&conf->counters[ReadFixable])) != 0)
+	n = atomic_read(&conf->counters[ReadFixable]);
+	if (n != 0)
 		seq_printf(seq, " ReadFixable=%d(%d)",
 			   n, conf->period[ReadFixable]);
 
-	if ((n=atomic_read(&conf->counters[WriteAll])) != 0)
+	n = atomic_read(&conf->counters[WriteAll]);
+	if (n != 0)
 		seq_puts(seq, " WriteAll");
 
 	seq_printf(seq, " nfaults=%d", conf->nfaults);
-- 
2.12.2

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web