Commit c8e5b163 authored by Josh Triplett's avatar Josh Triplett Committed by Linus Torvalds

rcutorture: style cleanup: avoid != NULL in boolean tests

Signed-off-by: default avatarJosh Triplett <josh@kernel.org>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 788e770e
...@@ -534,7 +534,7 @@ rcu_torture_writer(void *arg) ...@@ -534,7 +534,7 @@ rcu_torture_writer(void *arg)
rp->rtort_mbtest = 1; rp->rtort_mbtest = 1;
rcu_assign_pointer(rcu_torture_current, rp); rcu_assign_pointer(rcu_torture_current, rp);
smp_wmb(); smp_wmb();
if (old_rp != NULL) { if (old_rp) {
i = old_rp->rtort_pipe_count; i = old_rp->rtort_pipe_count;
if (i > RCU_TORTURE_PIPE_LEN) if (i > RCU_TORTURE_PIPE_LEN)
i = RCU_TORTURE_PIPE_LEN; i = RCU_TORTURE_PIPE_LEN;
...@@ -685,7 +685,7 @@ rcu_torture_printk(char *page) ...@@ -685,7 +685,7 @@ rcu_torture_printk(char *page)
atomic_read(&rcu_torture_wcount[i])); atomic_read(&rcu_torture_wcount[i]));
} }
cnt += sprintf(&page[cnt], "\n"); cnt += sprintf(&page[cnt], "\n");
if (cur_ops->stats != NULL) if (cur_ops->stats)
cnt += cur_ops->stats(&page[cnt]); cnt += cur_ops->stats(&page[cnt]);
return cnt; return cnt;
} }
...@@ -749,13 +749,13 @@ static void rcu_torture_shuffle_tasks(void) ...@@ -749,13 +749,13 @@ static void rcu_torture_shuffle_tasks(void)
set_cpus_allowed(current, tmp_mask); set_cpus_allowed(current, tmp_mask);
if (reader_tasks != NULL) { if (reader_tasks) {
for (i = 0; i < nrealreaders; i++) for (i = 0; i < nrealreaders; i++)
if (reader_tasks[i]) if (reader_tasks[i])
set_cpus_allowed(reader_tasks[i], tmp_mask); set_cpus_allowed(reader_tasks[i], tmp_mask);
} }
if (fakewriter_tasks != NULL) { if (fakewriter_tasks) {
for (i = 0; i < nfakewriters; i++) for (i = 0; i < nfakewriters; i++)
if (fakewriter_tasks[i]) if (fakewriter_tasks[i])
set_cpus_allowed(fakewriter_tasks[i], tmp_mask); set_cpus_allowed(fakewriter_tasks[i], tmp_mask);
...@@ -808,21 +808,21 @@ rcu_torture_cleanup(void) ...@@ -808,21 +808,21 @@ rcu_torture_cleanup(void)
int i; int i;
fullstop = 1; fullstop = 1;
if (shuffler_task != NULL) { if (shuffler_task) {
VERBOSE_PRINTK_STRING("Stopping rcu_torture_shuffle task"); VERBOSE_PRINTK_STRING("Stopping rcu_torture_shuffle task");
kthread_stop(shuffler_task); kthread_stop(shuffler_task);
} }
shuffler_task = NULL; shuffler_task = NULL;
if (writer_task != NULL) { if (writer_task) {
VERBOSE_PRINTK_STRING("Stopping rcu_torture_writer task"); VERBOSE_PRINTK_STRING("Stopping rcu_torture_writer task");
kthread_stop(writer_task); kthread_stop(writer_task);
} }
writer_task = NULL; writer_task = NULL;
if (reader_tasks != NULL) { if (reader_tasks) {
for (i = 0; i < nrealreaders; i++) { for (i = 0; i < nrealreaders; i++) {
if (reader_tasks[i] != NULL) { if (reader_tasks[i]) {
VERBOSE_PRINTK_STRING( VERBOSE_PRINTK_STRING(
"Stopping rcu_torture_reader task"); "Stopping rcu_torture_reader task");
kthread_stop(reader_tasks[i]); kthread_stop(reader_tasks[i]);
...@@ -834,9 +834,9 @@ rcu_torture_cleanup(void) ...@@ -834,9 +834,9 @@ rcu_torture_cleanup(void)
} }
rcu_torture_current = NULL; rcu_torture_current = NULL;
if (fakewriter_tasks != NULL) { if (fakewriter_tasks) {
for (i = 0; i < nfakewriters; i++) { for (i = 0; i < nfakewriters; i++) {
if (fakewriter_tasks[i] != NULL) { if (fakewriter_tasks[i]) {
VERBOSE_PRINTK_STRING( VERBOSE_PRINTK_STRING(
"Stopping rcu_torture_fakewriter task"); "Stopping rcu_torture_fakewriter task");
kthread_stop(fakewriter_tasks[i]); kthread_stop(fakewriter_tasks[i]);
...@@ -847,7 +847,7 @@ rcu_torture_cleanup(void) ...@@ -847,7 +847,7 @@ rcu_torture_cleanup(void)
fakewriter_tasks = NULL; fakewriter_tasks = NULL;
} }
if (stats_task != NULL) { if (stats_task) {
VERBOSE_PRINTK_STRING("Stopping rcu_torture_stats task"); VERBOSE_PRINTK_STRING("Stopping rcu_torture_stats task");
kthread_stop(stats_task); kthread_stop(stats_task);
} }
...@@ -858,7 +858,7 @@ rcu_torture_cleanup(void) ...@@ -858,7 +858,7 @@ rcu_torture_cleanup(void)
rcu_torture_stats_print(); /* -After- the stats thread is stopped! */ rcu_torture_stats_print(); /* -After- the stats thread is stopped! */
if (cur_ops->cleanup != NULL) if (cur_ops->cleanup)
cur_ops->cleanup(); cur_ops->cleanup();
if (atomic_read(&n_rcu_torture_error)) if (atomic_read(&n_rcu_torture_error))
rcu_torture_print_module_parms("End of test: FAILURE"); rcu_torture_print_module_parms("End of test: FAILURE");
...@@ -875,7 +875,7 @@ rcu_torture_init(void) ...@@ -875,7 +875,7 @@ rcu_torture_init(void)
/* Process args and tell the world that the torturer is on the job. */ /* Process args and tell the world that the torturer is on the job. */
for (i = 0; cur_ops = torture_ops[i], cur_ops != NULL; i++) { for (i = 0; cur_ops = torture_ops[i], cur_ops; i++) {
cur_ops = torture_ops[i]; cur_ops = torture_ops[i];
if (strcmp(torture_type, cur_ops->name) == 0) { if (strcmp(torture_type, cur_ops->name) == 0) {
break; break;
...@@ -886,7 +886,7 @@ rcu_torture_init(void) ...@@ -886,7 +886,7 @@ rcu_torture_init(void)
torture_type); torture_type);
return (-EINVAL); return (-EINVAL);
} }
if (cur_ops->init != NULL) if (cur_ops->init)
cur_ops->init(); /* no "goto unwind" prior to this point!!! */ cur_ops->init(); /* no "goto unwind" prior to this point!!! */
if (nreaders >= 0) if (nreaders >= 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment