Commit b4652e8429100ba5c3ddb49499faa1188c98c246
Committed by
Linus Torvalds
1 parent
e17f74af35
Exists in
master
and in
20 other branches
mempolicy: lose unnecessary loop variable in mpol_parse_str()
We don't really need the extra variable 'i' in mpol_parse_str(). The only use is as the the loop variable. Then, it's assigned to 'mode'. Just use mode, and loose the 'uninitialized_var()' macro. Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com> Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk> Cc: Ravikiran Thirumalai <kiran@scalex86.org> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Christoph Lameter <cl@linux-foundation.org> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 4 additions and 6 deletions Side-by-side Diff
mm/mempolicy.c
... | ... | @@ -2148,12 +2148,11 @@ |
2148 | 2148 | int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) |
2149 | 2149 | { |
2150 | 2150 | struct mempolicy *new = NULL; |
2151 | - unsigned short uninitialized_var(mode); | |
2151 | + unsigned short mode; | |
2152 | 2152 | unsigned short uninitialized_var(mode_flags); |
2153 | 2153 | nodemask_t nodes; |
2154 | 2154 | char *nodelist = strchr(str, ':'); |
2155 | 2155 | char *flags = strchr(str, '='); |
2156 | - int i; | |
2157 | 2156 | int err = 1; |
2158 | 2157 | |
2159 | 2158 | if (nodelist) { |
2160 | 2159 | |
... | ... | @@ -2169,13 +2168,12 @@ |
2169 | 2168 | if (flags) |
2170 | 2169 | *flags++ = '\0'; /* terminate mode string */ |
2171 | 2170 | |
2172 | - for (i = 0; i <= MPOL_LOCAL; i++) { | |
2173 | - if (!strcmp(str, policy_types[i])) { | |
2174 | - mode = i; | |
2171 | + for (mode = 0; mode <= MPOL_LOCAL; mode++) { | |
2172 | + if (!strcmp(str, policy_types[mode])) { | |
2175 | 2173 | break; |
2176 | 2174 | } |
2177 | 2175 | } |
2178 | - if (i > MPOL_LOCAL) | |
2176 | + if (mode > MPOL_LOCAL) | |
2179 | 2177 | goto out; |
2180 | 2178 | |
2181 | 2179 | switch (mode) { |