Skip to contentSkip to conversation

sched/rt.c: handle exceptions gracefully

PATCH New Hui Su 1 participant 1 message Sep 28, 2020 Scheduler

lore
Share & tools
lore

Hui Su

author
#0 lore raw

PATCH 1/1 sched/rt.c: handle exceptions gracefully

handle exceptions gracefully, and avoid using
if (0) .

---
 kernel/sched/rt.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
kernel/sched/rt.c +7 -6
index f215eea6a966..1dd6cbd67e6e 100644
@@ -2753,14 +2753,15 @@ int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
 		sched_rt_do_global();
 		sched_dl_do_global();
 	}
-	if (0) {
-undo:
-		sysctl_sched_rt_period = old_period;
-		sysctl_sched_rt_runtime = old_runtime;
-	}
-	mutex_unlock(&mutex);
 
+out:
+	mutex_unlock(&mutex);
 	return ret;
+
+undo:
+	sysctl_sched_rt_period = old_period;
+	sysctl_sched_rt_runtime = old_runtime;
+	goto out;
 }
 
 int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
Signature · 1 line
2.25.1