Showing error 990

User: Jiri Slaby
Error type: Leaving function in locked state
Error type description: Some lock is not unlocked on all paths of a function, so it is leaked
File location: mm/shmem.c
Line in file: 468
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2012-03-02 21:35:18 UTC


Source:

 438
 439/**
 440 * shmem_free_swp - free some swap entries in a directory
 441 * @dir:        pointer to the directory
 442 * @edir:       pointer after last entry of the directory
 443 * @punch_lock: pointer to spinlock when needed for the holepunch case
 444 */
 445static int shmem_free_swp(swp_entry_t *dir, swp_entry_t *edir,
 446                                                spinlock_t *punch_lock)
 447{
 448        spinlock_t *punch_unlock = NULL;
 449        swp_entry_t *ptr;
 450        int freed = 0;
 451
 452        for (ptr = dir; ptr < edir; ptr++) {
 453                if (ptr->val) {
 454                        if (unlikely(punch_lock)) {
 455                                punch_unlock = punch_lock;
 456                                punch_lock = NULL;
 457                                spin_lock(punch_unlock);
 458                                if (!ptr->val)
 459                                        continue;
 460                        }
 461                        free_swap_and_cache(*ptr);
 462                        *ptr = (swp_entry_t){0};
 463                        freed++;
 464                }
 465        }
 466        if (punch_unlock)
 467                spin_unlock(punch_unlock);
 468        return freed;
 469}
 470
 471static int shmem_map_and_free_swp(struct page *subdir, int offset,
 472                int limit, struct page ***dir, spinlock_t *punch_lock)
 473{
 474        swp_entry_t *ptr;
 475        int freed = 0;
 476
 477        ptr = shmem_swp_map(subdir);
 478        for (; offset < limit; offset += LATENCY_LIMIT) {
Show full sources