Showing error 954

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/usb/class/usblp.c
Line in file: 822
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2012-03-02 21:35:17 UTC


Source:

 792
 793raise_submit:
 794raise_badaddr:
 795        usb_unanchor_urb(writeurb);
 796        usb_free_urb(writeurb);
 797raise_urb:
 798raise_wait:
 799collect_error:                /* Out of raise sequence */
 800        mutex_unlock(&usblp->wmut);
 801raise_biglock:
 802        return writecount ? writecount : rv;
 803}
 804
 805/*
 806 * Notice that we fail to restart in a few cases: on EFAULT, on restart
 807 * error, etc. This is the historical behaviour. In all such cases we return
 808 * EIO, and applications loop in order to get the new read going.
 809 */
 810static ssize_t usblp_read(struct file *file, char __user *buffer, size_t len, loff_t *ppos)
 811{
 812        struct usblp *usblp = file->private_data;
 813        ssize_t count;
 814        ssize_t avail;
 815        int rv;
 816
 817        if (!usblp->bidir)
 818                return -EINVAL;
 819
 820        rv = usblp_rwait_and_lock(usblp, !!(file->f_flags & O_NONBLOCK));
 821        if (rv < 0)
 822                return rv;
 823
 824        if ((avail = usblp->rstatus) < 0) {
 825                printk(KERN_ERR "usblp%d: error %d reading from printer\n",
 826                    usblp->minor, (int)avail);
 827                usblp_submit_read(usblp);
 828                count = -EIO;
 829                goto done;
 830        }
 831
 832        count = len < avail - usblp->readcount ? len : avail - usblp->readcount;
Show full sources