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

From: SF Markus Elfring
Date: Tue May 02 2017 - 10:29:59 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxxx>
---
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