Showing error 1053

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: drivers/mtd/chips/cfi_cmdset_0001.c
Line in file: 947
Project: Linux Kernel
Project version: 2.6.28
Tools: Undetermined 1
Entered: 2012-03-04 17:07:06 UTC


Source:

 917                        shared->erasing = chip;
 918                spin_unlock(&shared->lock);
 919        }
 920        ret = chip_ready(map, chip, adr, mode);
 921        if (ret == -EAGAIN)
 922                goto retry;
 923
 924        return ret;
 925}
 926
 927static void put_chip(struct map_info *map, struct flchip *chip, unsigned long adr)
 928{
 929        struct cfi_private *cfi = map->fldrv_priv;
 930
 931        if (chip->priv) {
 932                struct flchip_shared *shared = chip->priv;
 933                spin_lock(&shared->lock);
 934                if (shared->writing == chip && chip->oldstate == FL_READY) {
 935                        /* We own the ability to write, but we're done */
 936                        shared->writing = shared->erasing;
 937                        if (shared->writing && shared->writing != chip) {
 938                                /* give back ownership to who we loaned it from */
 939                                struct flchip *loaner = shared->writing;
 940                                spin_lock(loaner->mutex);
 941                                spin_unlock(&shared->lock);
 942                                spin_unlock(chip->mutex);
 943                                put_chip(map, loaner, loaner->start);
 944                                spin_lock(chip->mutex);
 945                                spin_unlock(loaner->mutex);
 946                                wake_up(&chip->wq);
 947                                return;
 948                        }
 949                        shared->erasing = NULL;
 950                        shared->writing = NULL;
 951                } else if (shared->erasing == chip && shared->writing != chip) {
 952                        /*
 953                         * We own the ability to erase without the ability
 954                         * to write, which means the erase was suspended
 955                         * and some other partition is currently writing.
 956                         * Don't let the switch below mess things up since
 957                         * we don't have ownership to resume anything.
Show full sources