Skip to content

Commit 0241e9e

Browse files
Chen Ridonghtejun
authored andcommitted
cpuset: simplify node setting on error
There is no need to jump to the 'done' label upon failure, as no cleanup is required. Return the error code directly instead. Signed-off-by: Chen Ridong <[email protected]> Reviewed-by: Waiman Long <[email protected]> Reviewed-by: Michal Koutný <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 01a7435 commit 0241e9e

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

kernel/cgroup/cpuset.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2897,21 +2897,19 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,
28972897
*/
28982898
retval = nodelist_parse(buf, trialcs->mems_allowed);
28992899
if (retval < 0)
2900-
goto done;
2900+
return retval;
29012901

29022902
if (!nodes_subset(trialcs->mems_allowed,
2903-
top_cpuset.mems_allowed)) {
2904-
retval = -EINVAL;
2905-
goto done;
2906-
}
2903+
top_cpuset.mems_allowed))
2904+
return -EINVAL;
2905+
2906+
/* No change? nothing to do */
2907+
if (nodes_equal(cs->mems_allowed, trialcs->mems_allowed))
2908+
return 0;
29072909

2908-
if (nodes_equal(cs->mems_allowed, trialcs->mems_allowed)) {
2909-
retval = 0; /* Too easy - nothing to do */
2910-
goto done;
2911-
}
29122910
retval = validate_change(cs, trialcs);
29132911
if (retval < 0)
2914-
goto done;
2912+
return retval;
29152913

29162914
check_insane_mems_config(&trialcs->mems_allowed);
29172915

@@ -2921,8 +2919,7 @@ static int update_nodemask(struct cpuset *cs, struct cpuset *trialcs,
29212919

29222920
/* use trialcs->mems_allowed as a temp variable */
29232921
update_nodemasks_hier(cs, &trialcs->mems_allowed);
2924-
done:
2925-
return retval;
2922+
return 0;
29262923
}
29272924

29282925
bool current_cpuset_is_being_rebound(void)

0 commit comments

Comments
 (0)