The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Hui Su <sh_def@163.com>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	linux-kernel@vger.kernel.org
Subject: [PATCH] sched/rt.c: handle exceptions gracefully
Date: Mon, 28 Sep 2020 23:22:05 +0800	[thread overview]
Message-ID: <20200928152205.GA17900@rlk> (raw)

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

Signed-off-by: Hui Su <sh_def@163.com>
---
 kernel/sched/rt.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index f215eea6a966..1dd6cbd67e6e 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -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,
-- 
2.25.1



                 reply	other threads:[~2020-09-28 15:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200928152205.GA17900@rlk \
    --to=sh_def@163.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox