Showing error 865

User: Jiri Slaby
Error type: Resource Leak
Error type description: The code omits to put the resource to the system for reuse
File location: kernel/spinlock.c
Line in file: 39
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:40:13 UTC


Source:

  9 * SMP and the DEBUG_SPINLOCK cases. (UP-nondebug inlines them)
 10 *
 11 * Note that some architectures have special knowledge about the
 12 * stack frames of these functions in their profile_pc. If you
 13 * change anything significant here that could change the stack
 14 * frame contact the architecture maintainers.
 15 */
 16
 17#include <linux/linkage.h>
 18#include <linux/preempt.h>
 19#include <linux/spinlock.h>
 20#include <linux/interrupt.h>
 21#include <linux/debug_locks.h>
 22#include <linux/module.h>
 23
 24int __lockfunc _spin_trylock(spinlock_t *lock)
 25{
 26        preempt_disable();
 27        if (_raw_spin_trylock(lock)) {
 28                spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
 29                return 1;
 30        }
 31        
 32        preempt_enable();
 33        return 0;
 34}
 35EXPORT_SYMBOL(_spin_trylock);
 36
 37int __lockfunc _read_trylock(rwlock_t *lock)
 38{
 39        preempt_disable();
 40        if (_raw_read_trylock(lock)) {
 41                rwlock_acquire_read(&lock->dep_map, 0, 1, _RET_IP_);
 42                return 1;
 43        }
 44
 45        preempt_enable();
 46        return 0;
 47}
 48EXPORT_SYMBOL(_read_trylock);
 49
Show full sources