Showing error 639

User: Jiri Slaby
Error type: Double Unlock
Error type description: Some lock is unlocked twice unintentionally in a sequence
File location: drivers/thermal/thermal_sys.c
Line in file: 87
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:20:57 UTC


Source:

 57static DEFINE_MUTEX(thermal_list_lock);
 58
 59static int get_idr(struct idr *idr, struct mutex *lock, int *id)
 60{
 61        int err;
 62
 63      again:
 64        if (unlikely(idr_pre_get(idr, GFP_KERNEL) == 0))
 65                return -ENOMEM;
 66
 67        if (lock)
 68                mutex_lock(lock);
 69        err = idr_get_new(idr, NULL, id);
 70        if (lock)
 71                mutex_unlock(lock);
 72        if (unlikely(err == -EAGAIN))
 73                goto again;
 74        else if (unlikely(err))
 75                return err;
 76
 77        *id = *id & MAX_ID_MASK;
 78        return 0;
 79}
 80
 81static void release_idr(struct idr *idr, struct mutex *lock, int id)
 82{
 83        if (lock)
 84                mutex_lock(lock);
 85        idr_remove(idr, id);
 86        if (lock)
 87                mutex_unlock(lock);
 88}
 89
 90/* sys I/F for thermal zone */
 91
 92#define to_thermal_zone(_dev) \
 93        container_of(_dev, struct thermal_zone_device, device)
 94
 95static ssize_t
 96type_show(struct device *dev, struct device_attribute *attr, char *buf)
 97{
Show full sources