Showing error 935

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/mtdoops.c
Line in file: 358
Project: Linux Kernel
Project version: 2.6.28
Confirmation: Fixed by 48ec00ac895074f8a47bda8f3925ccaa46abb7a8
Tools: Stanse (1.2)
Entered: 2012-03-02 21:35:17 UTC


Source:

328        cxt->ready = 0;
329        spin_unlock_irqrestore(&cxt->writecount_lock, flags);
330
331        if (mtd->panic_write && in_interrupt())
332                /* Interrupt context, we're going to panic so try and log */
333                mtdoops_write(cxt, 1);
334        else
335                schedule_work(&cxt->work_write);
336}
337
338static void
339mtdoops_console_write(struct console *co, const char *s, unsigned int count)
340{
341        struct mtdoops_context *cxt = co->data;
342        struct mtd_info *mtd = cxt->mtd;
343        unsigned long flags;
344
345        if (!oops_in_progress) {
346                mtdoops_console_sync();
347                return;
348        }
349
350        if (!cxt->ready || !mtd)
351                return;
352
353        /* Locking on writecount ensures sequential writes to the buffer */
354        spin_lock_irqsave(&cxt->writecount_lock, flags);
355
356        /* Check ready status didn't change whilst waiting for the lock */
357        if (!cxt->ready)
358                return;
359
360        if (cxt->writecount == 0) {
361                u32 *stamp = cxt->oops_buf;
362                *stamp++ = cxt->nextcount;
363                *stamp = MTDOOPS_KERNMSG_MAGIC;
364                cxt->writecount = 8;
365        }
366
367        if ((count + cxt->writecount) > OOPS_PAGE_SIZE)
368                count = OOPS_PAGE_SIZE - cxt->writecount;
Show full sources