Showing error 936

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


Source:

100 */
101static ssize_t lock_read_file(struct hotplug_slot *slot, char *buf)
102{
103        int retval;
104        u8 value;
105
106        retval = get_lock_status(slot, &value);
107        if (retval)
108                goto lock_read_exit;
109        retval = sprintf (buf, "%d\n", value);
110
111lock_read_exit:
112        return retval;
113}
114
115/*
116 * Change the status of the Electro Mechanical Interlock (EMI)
117 * This is a toggle - in addition there must be at least 1 second
118 * in between toggles.
119 */
120static int set_lock_status(struct hotplug_slot *hotplug_slot, u8 status)
121{
122        struct slot *slot = hotplug_slot->private;
123        int retval;
124        u8 value;
125
126        mutex_lock(&slot->ctrl->crit_sect);
127
128        /* has it been >1 sec since our last toggle? */
129        if ((get_seconds() - slot->last_emi_toggle) < 1)
130                return -EINVAL;
131
132        /* see what our current state is */
133        retval = get_lock_status(hotplug_slot, &value);
134        if (retval || (value == status))
135                goto set_lock_exit;
136
137        slot->hpc_ops->toggle_emi(slot);
138set_lock_exit:
139        mutex_unlock(&slot->ctrl->crit_sect);
140        return 0;
Show full sources