Showing error 1059

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: 1208
Project: Linux Kernel
Project version: 2.6.28
Tools: Undetermined 1
Entered: 2012-03-04 17:07:06 UTC


Source:

1178
1179static int inval_cache_and_wait_for_operation(
1180                struct map_info *map, struct flchip *chip,
1181                unsigned long cmd_adr, unsigned long inval_adr, int inval_len,
1182                unsigned int chip_op_time, unsigned int chip_op_time_max)
1183{
1184        struct cfi_private *cfi = map->fldrv_priv;
1185        map_word status, status_OK = CMD(0x80);
1186        int chip_state = chip->state;
1187        unsigned int timeo, sleep_time, reset_timeo;
1188
1189        spin_unlock(chip->mutex);
1190        if (inval_len)
1191                INVALIDATE_CACHED_RANGE(map, inval_adr, inval_len);
1192        spin_lock(chip->mutex);
1193
1194        timeo = chip_op_time_max;
1195        if (!timeo)
1196                timeo = 500000;
1197        reset_timeo = timeo;
1198        sleep_time = chip_op_time / 2;
1199
1200        for (;;) {
1201                status = map_read(map, cmd_adr);
1202                if (map_word_andequal(map, status, status_OK, status_OK))
1203                        break;
1204
1205                if (!timeo) {
1206                        map_write(map, CMD(0x70), cmd_adr);
1207                        chip->state = FL_STATUS;
1208                        return -ETIME;
1209                }
1210
1211                /* OK Still waiting. Drop the lock, wait a while and retry. */
1212                spin_unlock(chip->mutex);
1213                if (sleep_time >= 1000000/HZ) {
1214                        /*
1215                         * Half of the normal delay still remaining
1216                         * can be performed with a sleeping delay instead
1217                         * of busy waiting.
1218                         */
Show full sources