Showing error 891

User: Jiri Slaby
Error type: Resource Leak
Error type description: The code omits to put the resource to the system for reuse
File location: drivers/scsi/eata.c
Line in file: 1061
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:41:42 UTC


Source:

1031{
1032#if defined(CONFIG_PCI)
1033        unsigned int addr;
1034        struct pci_dev *dev = NULL;
1035
1036        while ((dev = pci_get_class(PCI_CLASS_STORAGE_SCSI << 8, dev))) {
1037                addr = pci_resource_start(dev, 0);
1038
1039#if defined(DEBUG_PCI_DETECT)
1040                printk("%s: get_pci_dev, bus %d, devfn 0x%x, addr 0x%x.\n",
1041                       driver_name, dev->bus->number, dev->devfn, addr);
1042#endif
1043
1044                /* we are in so much trouble for a pci hotplug system with this driver
1045                 * anyway, so doing this at least lets people unload the driver and not
1046                 * cause memory problems, but in general this is a bad thing to do (this
1047                 * driver needs to be converted to the proper PCI api someday... */
1048                pci_dev_put(dev);
1049                if (addr + PCI_BASE_ADDRESS_0 == port_base)
1050                        return dev;
1051        }
1052#endif                                /* end CONFIG_PCI */
1053        return NULL;
1054}
1055
1056static void enable_pci_ports(void)
1057{
1058#if defined(CONFIG_PCI)
1059        struct pci_dev *dev = NULL;
1060
1061        while ((dev = pci_get_class(PCI_CLASS_STORAGE_SCSI << 8, dev))) {
1062#if defined(DEBUG_PCI_DETECT)
1063                printk("%s: enable_pci_ports, bus %d, devfn 0x%x.\n",
1064                       driver_name, dev->bus->number, dev->devfn);
1065#endif
1066
1067                if (pci_enable_device(dev))
1068                        printk
1069                            ("%s: warning, pci_enable_device failed, bus %d devfn 0x%x.\n",
1070                             driver_name, dev->bus->number, dev->devfn);
1071        }
Show full sources