linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] locking/rwsem: mark down_(read|write)_trylock() as  __must_check
@ 2022-02-17  8:15 Rolf Eike Beer
  0 siblings, 0 replies; only message in thread
From: Rolf Eike Beer @ 2022-02-17  8:15 UTC (permalink / raw)
  To: Peter Zijlstra, Boqun Feng, Ingo Molnar, Will Deacon, Waiman Long
  Cc: linux-kernel

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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-17  8:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17  8:15 [PATCH] locking/rwsem: mark down_(read|write)_trylock() as __must_check Rolf Eike Beer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).