Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rcutorture: Remove redundant assignment to cur_ops in for loop

The for loop in rcutorture_init uses the condition
cur_ops = torture_ops[i], cur_ops
but then makes the same assignment to cur_ops inside the loop. Remove the
redundant assignment inside the loop, and remove now-unnecessary braces.

Signed-off-by: Josh Triplett <josh@kernel.org>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Josh Triplett and committed by
Linus Torvalds
ade5fb81 c8e5b163

+6 -9
+6 -9
kernel/rcutorture.c
··· 502 502 .name = "sched" 503 503 }; 504 504 505 - static struct rcu_torture_ops *torture_ops[] = 506 - { &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops, &srcu_ops, 507 - &sched_ops, NULL }; 508 - 509 505 /* 510 506 * RCU torture writer kthread. Repeatedly substitutes a new structure 511 507 * for that pointed to by rcu_torture_current, freeing the old structure ··· 868 872 int i; 869 873 int cpu; 870 874 int firsterr = 0; 875 + static struct rcu_torture_ops *torture_ops[] = 876 + { &rcu_ops, &rcu_sync_ops, &rcu_bh_ops, &rcu_bh_sync_ops, 877 + &srcu_ops, &sched_ops, }; 871 878 872 879 /* Process args and tell the world that the torturer is on the job. */ 873 - 874 - for (i = 0; cur_ops = torture_ops[i], cur_ops; i++) { 880 + for (i = 0; i < ARRAY_SIZE(torture_ops); i++) { 875 881 cur_ops = torture_ops[i]; 876 - if (strcmp(torture_type, cur_ops->name) == 0) { 882 + if (strcmp(torture_type, cur_ops->name) == 0) 877 883 break; 878 - } 879 884 } 880 - if (cur_ops == NULL) { 885 + if (i == ARRAY_SIZE(torture_ops)) { 881 886 printk(KERN_ALERT "rcutorture: invalid torture type: \"%s\"\n", 882 887 torture_type); 883 888 return (-EINVAL);