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: | 886 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Undetermined 1
|
Entered: | 2012-03-04 17:07:06 UTC |
856 * its lock is taken. 857 */ 858 struct flchip_shared *shared = chip->priv; 859 struct flchip *contender; 860 spin_lock(&shared->lock); 861 contender = shared->writing; 862 if (contender && contender != chip) { 863 /* 864 * The engine to perform desired operation on this 865 * partition is already in use by someone else. 866 * Let's fight over it in the context of the chip 867 * currently using it. If it is possible to suspend, 868 * that other partition will do just that, otherwise 869 * it'll happily send us to sleep. In any case, when 870 * get_chip returns success we're clear to go ahead. 871 */ 872 ret = spin_trylock(contender->mutex); 873 spin_unlock(&shared->lock); 874 if (!ret) 875 goto retry; 876 spin_unlock(chip->mutex); 877 ret = chip_ready(map, contender, contender->start, mode); 878 spin_lock(chip->mutex); 879 880 if (ret == -EAGAIN) { 881 spin_unlock(contender->mutex); 882 goto retry; 883 } 884 if (ret) { 885 spin_unlock(contender->mutex); 886 return ret; 887 } 888 spin_lock(&shared->lock); 889 890 /* We should not own chip if it is already 891 * in FL_SYNCING state. Put contender and retry. */ 892 if (chip->state == FL_SYNCING) { 893 put_chip(map, contender, contender->start); 894 spin_unlock(contender->mutex); 895 goto retry; 896 }