diff options
author | Peter Zijlstra <peterz@infradead.org> | 2025-07-19 19:25:53 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2025-07-19 19:25:53 +0200 |
commit | ba28549bad8ab2b09264ebc8c2ca24af3537ee52 (patch) | |
tree | 202ce15fa4875018ae4cde5fb9a5c703737f35ec /rust/kernel | |
parent | 7ff495e26a39f3e7a3d4058df59b5b6d6f943cab (diff) | |
parent | 7a3cedafccf8e7d038ad4cfec5b38052647ceac5 (diff) |
Merge tag 'lockdep-for-tip.2025.07.16' of git://git.kernel.org/pub/scm/linux/kernel/git/boqun/linux into locking/core
Locking changes for v6.17:
- General
- Mark devm_mutex_init() as __must_check
- Add #[must_use] to Lock::try_lock()
- Remove OWNER_SPINNABLE in rwsem
- Remove redundant #ifdefs in mutex
- Lockdep
- Avoid returning struct in lock_stats()
- Change `static const` into enum for LOCKF_*_IRQ_*
- Temporarily use synchronize_rcu_expedited() in
lockdep_unregister_key() to speed things up.
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Diffstat (limited to 'rust/kernel')
-rw-r--r-- | rust/kernel/sync/lock.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/rust/kernel/sync/lock.rs b/rust/kernel/sync/lock.rs index e82fa5be289c..27202beef90c 100644 --- a/rust/kernel/sync/lock.rs +++ b/rust/kernel/sync/lock.rs @@ -175,6 +175,8 @@ impl<T: ?Sized, B: Backend> Lock<T, B> { /// Tries to acquire the lock. /// /// Returns a guard that can be used to access the data protected by the lock if successful. + // `Option<T>` is not `#[must_use]` even if `T` is, thus the attribute is needed here. + #[must_use = "if unused, the lock will be immediately unlocked"] pub fn try_lock(&self) -> Option<Guard<'_, T, B>> { // SAFETY: The constructor of the type calls `init`, so the existence of the object proves // that `init` was called. |