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_0002.c |
Line in file: | 618 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Undetermined 1
|
Entered: | 2012-03-04 17:07:06 UTC |
588 || (mode == FL_WRITING && (cfip->EraseSuspend & 0x2)) 589 || (mode == FL_WRITING && (cfip->EraseSuspend & 0x1) 590 ))) 591 goto sleep; 592 593 /* We could check to see if we're trying to access the sector 594 * that is currently being erased. However, no user will try 595 * anything like that so we just wait for the timeout. */ 596 597 /* Erase suspend */ 598 /* It's harmless to issue the Erase-Suspend and Erase-Resume 599 * commands when the erase algorithm isn't in progress. */ 600 map_write(map, CMD(0xB0), chip->in_progress_block_addr); 601 chip->oldstate = FL_ERASING; 602 chip->state = FL_ERASE_SUSPENDING; 603 chip->erase_suspended = 1; 604 for (;;) { 605 if (chip_ready(map, adr)) 606 break; 607 608 if (time_after(jiffies, timeo)) { 609 /* Should have suspended the erase by now. 610 * Send an Erase-Resume command as either 611 * there was an error (so leave the erase 612 * routine to recover from it) or we trying to 613 * use the erase-in-progress sector. */ 614 map_write(map, CMD(0x30), chip->in_progress_block_addr); 615 chip->state = FL_ERASING; 616 chip->oldstate = FL_READY; 617 printk(KERN_ERR "MTD %s(): chip not ready after erase suspend\n", __func__); 618 return -EIO; 619 } 620 621 spin_unlock(chip->mutex); 622 cfi_udelay(1); 623 spin_lock(chip->mutex); 624 /* Nobody will touch it while it's in state FL_ERASE_SUSPENDING. 625 So we can just loop here. */ 626 } 627 chip->state = FL_READY; 628 return 0;