All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] liveupdate: use scoped_guard for mutex in session operations
@ 2026-08-14  9:55 Chenghao Duan
  2026-08-14 14:10 ` Pratyush Yadav
  0 siblings, 1 reply; 2+ messages in thread
From: Chenghao Duan @ 2026-08-14  9:55 UTC (permalink / raw)
  To: pasha.tatashin, rppt, pratyush, graf, linux-kernel, linux-mm,
	kexec
  Cc: jianghaoran, duanchenghao

Replace manually paired mutex_lock/unlock with scoped_guard to align
with the coding style of the rest of the codebase and simplify locking
paths.

Signed-off-by: Chenghao Duan <duanchenghao@kylinos.cn>
---
 kernel/liveupdate/luo_session.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c
index f38b5b18f3f8..06307868a44e 100644
--- a/kernel/liveupdate/luo_session.c
+++ b/kernel/liveupdate/luo_session.c
@@ -290,9 +290,8 @@ static int luo_session_retrieve_fd(struct luo_session *session,
 	if (argp->fd < 0)
 		return argp->fd;
 
-	mutex_lock(&session->mutex);
-	err = luo_retrieve_file(&session->file_set, argp->token, &file);
-	mutex_unlock(&session->mutex);
+	scoped_guard(mutex, &session->mutex)
+		err = luo_retrieve_file(&session->file_set, argp->token, &file);
 	if (err < 0)
 		goto err_put_fd;
 
@@ -478,9 +477,8 @@ int luo_session_create(const char *name, struct file **filep)
 	if (err)
 		goto err_free;
 
-	mutex_lock(&session->mutex);
-	err = luo_session_getfile(session, filep);
-	mutex_unlock(&session->mutex);
+	scoped_guard(mutex, &session->mutex)
+		err = luo_session_getfile(session, filep);
 	if (err)
 		goto err_remove;
 	up_read(&luo_session_serialize_rwsem);
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-14 14:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14  9:55 [PATCH] liveupdate: use scoped_guard for mutex in session operations Chenghao Duan
2026-08-14 14:10 ` Pratyush Yadav

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.