From: Rolf Eike Beer <eb@emlix.com>
To: Peter Zijlstra <peterz@infradead.org>,
Boqun Feng <boqun.feng@gmail.com>, Ingo Molnar <mingo@redhat.com>,
Will Deacon <will@kernel.org>, Waiman Long <longman@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] locking/rwsem: mark down_(read|write)_trylock() as __must_check
Date: Thu, 17 Feb 2022 09:15:33 +0100 [thread overview]
Message-ID: <15670760.jIsrciUiTQ@mobilepool36.emlix.com> (raw)
When you don't look at the return code you can't know if you actually got
the lock.
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
---
include/linux/rwsem.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index f9348769e558..f62fa3ec95de 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -178,7 +178,7 @@ extern int __must_check down_read_killable(struct rw_semaphore *sem);
/*
* trylock for reading -- returns 1 if successful, 0 if contention
*/
-extern int down_read_trylock(struct rw_semaphore *sem);
+extern int __must_check down_read_trylock(struct rw_semaphore *sem);
/*
* lock for writing
@@ -189,7 +189,7 @@ extern int __must_check down_write_killable(struct rw_semaphore *sem);
/*
* trylock for writing -- returns 1 if successful, 0 if contention
*/
-extern int down_write_trylock(struct rw_semaphore *sem);
+extern int __must_check down_write_trylock(struct rw_semaphore *sem);
/*
* release a read lock
--
2.35.1
--
Rolf Eike Beer, emlix GmbH, https://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055
emlix - smart embedded open source
reply other threads:[~2022-02-17 8:25 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=15670760.jIsrciUiTQ@mobilepool36.emlix.com \
--to=eb@emlix.com \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.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
all inboxes | Powered by JetHome®