User: | Jiri Slaby |
Error type: | Double Lock |
Error type description: | Some lock is locked twice unintentionally in a sequence |
File location: | drivers/mtd/chips/cfi_cmdset_0001.c |
Line in file: | 860 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Stanse
(1.2)
|
Entered: | 2013-03-03 21:03:48 UTC |
830 831static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode) 832{ 833 int ret; 834 DECLARE_WAITQUEUE(wait, current); 835 836 retry: 837 if (chip->priv && 838 (mode == FL_WRITING || mode == FL_ERASING || mode == FL_OTP_WRITE 839 || mode == FL_SHUTDOWN) && chip->state != FL_SYNCING) { 840 /* 841 * OK. We have possibility for contention on the write/erase 842 * operations which are global to the real chip and not per 843 * partition. So let's fight it over in the partition which 844 * currently has authority on the operation. 845 * 846 * The rules are as follows: 847 * 848 * - any write operation must own shared->writing. 849 * 850 * - any erase operation must own _both_ shared->writing and 851 * shared->erasing. 852 * 853 * - contention arbitration is handled in the owner's context. 854 * 855 * The 'shared' struct can be read and/or written only when 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.