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>
This commit is contained in:
David Howells 2013-09-24 10:35:16 +01:00
parent d0a059cac6
commit ccc3e6d9c9
5 changed files with 27 additions and 20 deletions

View file

@ -219,11 +219,15 @@ 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)
{
atomic_inc(&key->usage);
return key;
}
static inline struct key *key_get(struct key *key)
{
if (key)
atomic_inc(&key->usage);
return key;
return key ? __key_get(key) : key;
}
static inline void key_ref_put(key_ref_t key_ref)