Showing error 862

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: 26
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:40:13 UTC


Source:

  1/*
  2 * Copyright (2004) Linus Torvalds
  3 *
  4 * Author: Zwane Mwaikambo <zwane@fsmlabs.com>
  5 *
  6 * Copyright (2004, 2005) Ingo Molnar
  7 *
  8 * This file contains the spinlock/rwlock implementations for the
  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
Show full sources