On Sat, Oct 26, 2024 at 11:07:27AM +0300, Dan Carpenter wrote: > On Fri, Oct 25, 2024 at 06:04:45PM -0700, Paul E. McKenney wrote: > > On Fri, Oct 25, 2024 at 09:58:05AM +0300, Dan Carpenter wrote: > > > Hello Paul E. McKenney, > > > > > > Commit 1e07186d7377 ("refscale: Add srcu_read_lock_lite() support > > > using "srcu-lite"") from Oct 15, 2024 (linux-next), leads to the > > > following Smatch static checker warning: > > > > > > kernel/rcu/refscale.c:1151 ref_scale_init() > > > warn: inconsistent indenting > > > > > > kernel/rcu/refscale.c > > > 1141 for (i = 0; i < ARRAY_SIZE(scale_ops); i++) { > > > 1142 cur_ops = scale_ops[i]; if (strcmp(scale_type, > > > 1143 cur_ops->name) == 0) > > > 1144 break; > > > 1145 } > > > 1146 if (i == ARRAY_SIZE(scale_ops)) { > > > 1147 pr_alert("rcu-scale: invalid scale type: \"%s\"\n", > > > 1148 scale_type); pr_alert("rcu-scale types:"); for (i = 0; > > > 1149 i < ARRAY_SIZE(scale_ops); i++) > > > 1150 pr_cont(" %s", scale_ops[i]->name); > > > --> 1151 pr_cont("\n"); firsterr = -EINVAL; cur_ops = NULL; > > > 1152 goto unwind; > > > > > > This looks like you pressed the wrong button in vim and it accidentally jumbled > > > the code? > > > > > > 1153 } > > > 1154 if (cur_ops->init) > > > 1155 if (!cur_ops->init()) { > > > 1156 firsterr = -EUCLEAN; > > > 1157 goto unwind; > > > 1158 } > > > > Excellent guess!!! :-( > > > > How about the following? > > > > Thanx, Paul > > > > ------------------------------------------------------------------------ > > > > commit a489ef720efa78763afa39fe88d09dbb4176a47d > > Author: Paul E. McKenney <paulmck@xxxxxxxxxx> > > Date: Fri Oct 25 17:55:29 2024 -0700 > > > > refscale: Undo j/J vim mistake in ref_scale_init() > > > > This commit gives each of three statements a line of their own. > > > > Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> > > Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxx> > > > > diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c > > index 7770e202d1ea1..7e6472a86dba8 100644 > > --- a/kernel/rcu/refscale.c > > +++ b/kernel/rcu/refscale.c > > @@ -1182,7 +1182,9 @@ ref_scale_init(void) > > scale_type); pr_alert("rcu-scale types:"); for (i = 0; > ^^^^^^^^^^^ > This for statement is messed up still. :( And also a nearby "if" statement (finally looking at the offending commit). With the addition of the patch shown below, are there any more? Thanx, Paul ------------------------------------------------------------------------ diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index 7e6472a86dba8..1b47376acdc40 100644 --- a/kernel/rcu/refscale.c +++ b/kernel/rcu/refscale.c @@ -1173,14 +1173,14 @@ ref_scale_init(void) return -EBUSY; for (i = 0; i < ARRAY_SIZE(scale_ops); i++) { - cur_ops = scale_ops[i]; if (strcmp(scale_type, - cur_ops->name) == 0) + cur_ops = scale_ops[i]; + if (strcmp(scale_type, cur_ops->name) == 0) break; } if (i == ARRAY_SIZE(scale_ops)) { - pr_alert("rcu-scale: invalid scale type: \"%s\"\n", - scale_type); pr_alert("rcu-scale types:"); for (i = 0; - i < ARRAY_SIZE(scale_ops); i++) + pr_alert("rcu-scale: invalid scale type: \"%s\"\n", scale_type); + pr_alert("rcu-scale types:"); + for (i = 0; i < ARRAY_SIZE(scale_ops); i++) pr_cont(" %s", scale_ops[i]->name); pr_cont("\n"); firsterr = -EINVAL;