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/message/fusion/mptctl.c |
Line in file: | 192 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Stanse
(1.2)
|
Entered: | 2012-05-21 20:30:05 UTC |
162#define MAX_SGL_BYTES ((MAX_FRAGS_SPILL1 + 1 + (4 * FRAGS_PER_BUCKET)) * 8) 163 164/* linux only seems to ever give 128kB MAX contiguous (GFP_USER) mem bytes */ 165#define MAX_KMALLOC_SZ (128*1024) 166 167#define MPT_IOCTL_DEFAULT_TIMEOUT 10 /* Default timeout value (seconds) */ 168 169/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 170/** 171 * mptctl_syscall_down - Down the MPT adapter syscall semaphore. 172 * @ioc: Pointer to MPT adapter 173 * @nonblock: boolean, non-zero if O_NONBLOCK is set 174 * 175 * All of the ioctl commands can potentially sleep, which is illegal 176 * with a spinlock held, thus we perform mutual exclusion here. 177 * 178 * Returns negative errno on error, or zero for success. 179 */ 180static inline int 181mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock) 182{ 183 int rc = 0; 184 185 if (nonblock) { 186 if (!mutex_trylock(&ioc->ioctl->ioctl_mutex)) 187 rc = -EAGAIN; 188 } else { 189 if (mutex_lock_interruptible(&ioc->ioctl->ioctl_mutex)) 190 rc = -ERESTARTSYS; 191 } 192 return rc; 193} 194 195/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 196/* 197 * This is the callback for any message we have posted. The message itself 198 * will be returned to the message pool when we return from the IRQ 199 * 200 * This runs in irq context so be short and sweet. 201 */ 202static int