diff options
author | David Howells <dhowells@redhat.com> | 2013-09-24 10:35:16 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2013-09-24 10:35:16 +0100 |
commit | ccc3e6d9c9aea07a0b60b2b0bfc5b05a704b66d5 (patch) | |
tree | d111175934b1454fa275fe056f8c6d320e504b01 /include | |
parent | d0a059cac6523b23ad7d743dec8783705aab1668 (diff) | |
download | linux-ccc3e6d9c9aea07a0b60b2b0bfc5b05a704b66d5.tar.gz linux-ccc3e6d9c9aea07a0b60b2b0bfc5b05a704b66d5.tar.bz2 linux-ccc3e6d9c9aea07a0b60b2b0bfc5b05a704b66d5.zip |
KEYS: Define a __key_get() wrapper to use rather than atomic_inc()
Define a __key_get() wrapper to use rather than atomic_inc() on the key usage
count as this makes it easier to hook in refcount error debugging.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/key.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/include/linux/key.h b/include/linux/key.h index d573e820a23d..ef596c7af585 100644 --- a/include/linux/key.h +++ b/include/linux/key.h @@ -219,13 +219,17 @@ extern void key_revoke(struct key *key); extern void key_invalidate(struct key *key); extern void key_put(struct key *key); -static inline struct key *key_get(struct key *key) +static inline struct key *__key_get(struct key *key) { - if (key) - atomic_inc(&key->usage); + atomic_inc(&key->usage); return key; } +static inline struct key *key_get(struct key *key) +{ + return key ? __key_get(key) : key; +} + static inline void key_ref_put(key_ref_t key_ref) { key_put(key_ref_to_ptr(key_ref)); |