diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2010-03-23 16:35:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-24 19:31:21 -0400 |
commit | 926f2ae04f183098cf9a30521776fb2759c8afeb (patch) | |
tree | 2d8583f77478557d508068ccb9bcc62cdc81920d /mm/mempolicy.c | |
parent | 12821f5fb942e795f8009ece14bde868893bd811 (diff) |
tmpfs: cleanup mpol_parse_str()
mpol_parse_str() made lots 'err' variable related bug. Because it is ugly
and reviewing unfriendly.
This patch simplifies it.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Ravikiran Thirumalai <kiran@scalex86.org>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Mel Gorman <mel@csn.ul.ie>
Acked-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r-- | mm/mempolicy.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index fb71790398f0..6cdfa1df57f6 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -2195,8 +2195,8 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | |||
2195 | char *rest = nodelist; | 2195 | char *rest = nodelist; |
2196 | while (isdigit(*rest)) | 2196 | while (isdigit(*rest)) |
2197 | rest++; | 2197 | rest++; |
2198 | if (!*rest) | 2198 | if (*rest) |
2199 | err = 0; | 2199 | goto out; |
2200 | } | 2200 | } |
2201 | break; | 2201 | break; |
2202 | case MPOL_INTERLEAVE: | 2202 | case MPOL_INTERLEAVE: |
@@ -2205,7 +2205,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | |||
2205 | */ | 2205 | */ |
2206 | if (!nodelist) | 2206 | if (!nodelist) |
2207 | nodes = node_states[N_HIGH_MEMORY]; | 2207 | nodes = node_states[N_HIGH_MEMORY]; |
2208 | err = 0; | ||
2209 | break; | 2208 | break; |
2210 | case MPOL_LOCAL: | 2209 | case MPOL_LOCAL: |
2211 | /* | 2210 | /* |
@@ -2214,7 +2213,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | |||
2214 | if (nodelist) | 2213 | if (nodelist) |
2215 | goto out; | 2214 | goto out; |
2216 | mode = MPOL_PREFERRED; | 2215 | mode = MPOL_PREFERRED; |
2217 | err = 0; | ||
2218 | break; | 2216 | break; |
2219 | case MPOL_DEFAULT: | 2217 | case MPOL_DEFAULT: |
2220 | /* | 2218 | /* |
@@ -2229,7 +2227,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | |||
2229 | */ | 2227 | */ |
2230 | if (!nodelist) | 2228 | if (!nodelist) |
2231 | goto out; | 2229 | goto out; |
2232 | err = 0; | ||
2233 | } | 2230 | } |
2234 | 2231 | ||
2235 | mode_flags = 0; | 2232 | mode_flags = 0; |
@@ -2243,13 +2240,14 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | |||
2243 | else if (!strcmp(flags, "relative")) | 2240 | else if (!strcmp(flags, "relative")) |
2244 | mode_flags |= MPOL_F_RELATIVE_NODES; | 2241 | mode_flags |= MPOL_F_RELATIVE_NODES; |
2245 | else | 2242 | else |
2246 | err = 1; | 2243 | goto out; |
2247 | } | 2244 | } |
2248 | 2245 | ||
2249 | new = mpol_new(mode, mode_flags, &nodes); | 2246 | new = mpol_new(mode, mode_flags, &nodes); |
2250 | if (IS_ERR(new)) | 2247 | if (IS_ERR(new)) |
2251 | err = 1; | 2248 | goto out; |
2252 | else { | 2249 | |
2250 | { | ||
2253 | int ret; | 2251 | int ret; |
2254 | NODEMASK_SCRATCH(scratch); | 2252 | NODEMASK_SCRATCH(scratch); |
2255 | if (scratch) { | 2253 | if (scratch) { |
@@ -2260,13 +2258,15 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | |||
2260 | ret = -ENOMEM; | 2258 | ret = -ENOMEM; |
2261 | NODEMASK_SCRATCH_FREE(scratch); | 2259 | NODEMASK_SCRATCH_FREE(scratch); |
2262 | if (ret) { | 2260 | if (ret) { |
2263 | err = 1; | ||
2264 | mpol_put(new); | 2261 | mpol_put(new); |
2265 | } else if (no_context) { | 2262 | goto out; |
2266 | /* save for contextualization */ | ||
2267 | new->w.user_nodemask = nodes; | ||
2268 | } | 2263 | } |
2269 | } | 2264 | } |
2265 | err = 0; | ||
2266 | if (no_context) { | ||
2267 | /* save for contextualization */ | ||
2268 | new->w.user_nodemask = nodes; | ||
2269 | } | ||
2270 | 2270 | ||
2271 | out: | 2271 | out: |
2272 | /* Restore string for error message */ | 2272 | /* Restore string for error message */ |