Showing error 785

User: Jiri Slaby
Error type: Memory Leak
Error type description: There the code omits to free some allocated memory
File location: drivers/pci/hotplug/shpchp_ctrl.c
Line in file: 447
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:26:27 UTC


Source:

417        struct slot *p_slot = info->p_slot;
418
419        mutex_lock(&p_slot->lock);
420        switch (p_slot->state) {
421        case POWEROFF_STATE:
422                mutex_unlock(&p_slot->lock);
423                shpchp_disable_slot(p_slot);
424                mutex_lock(&p_slot->lock);
425                p_slot->state = STATIC_STATE;
426                break;
427        case POWERON_STATE:
428                mutex_unlock(&p_slot->lock);
429                if (shpchp_enable_slot(p_slot))
430                        p_slot->hpc_ops->green_led_off(p_slot);
431                mutex_lock(&p_slot->lock);
432                p_slot->state = STATIC_STATE;
433                break;
434        default:
435                break;
436        }
437        mutex_unlock(&p_slot->lock);
438
439        kfree(info);
440}
441
442void shpchp_queue_pushbutton_work(struct work_struct *work)
443{
444        struct slot *p_slot = container_of(work, struct slot, work.work);
445        struct pushbutton_work_info *info;
446
447        info = kmalloc(sizeof(*info), GFP_KERNEL);
448        if (!info) {
449                ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n",
450                         __func__);
451                return;
452        }
453        info->p_slot = p_slot;
454        INIT_WORK(&info->work, shpchp_pushbutton_thread);
455
456        mutex_lock(&p_slot->lock);
457        switch (p_slot->state) {
Show full sources