Showing error 1921

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/usb/gadget/goku_udc.c
Line in file: 1771
Project: Linux Kernel
Project version: 2.6.28
Tools: Cppcheck (1.59)
Entered: 2013-10-17 18:38:34 UTC


Source:

1741                iounmap(dev->regs);
1742        if (dev->got_region)
1743                release_mem_region(pci_resource_start (pdev, 0),
1744                                pci_resource_len (pdev, 0));
1745        if (dev->enabled)
1746                pci_disable_device(pdev);
1747        device_unregister(&dev->gadget.dev);
1748
1749        pci_set_drvdata(pdev, NULL);
1750        dev->regs = NULL;
1751        the_controller = NULL;
1752
1753        INFO(dev, "unbind\n");
1754}
1755
1756/* wrap this driver around the specified pci device, but
1757 * don't respond over USB until a gadget driver binds to us.
1758 */
1759
1760static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1761{
1762        struct goku_udc                *dev = NULL;
1763        unsigned long                resource, len;
1764        void __iomem                *base = NULL;
1765        int                        retval;
1766
1767        /* if you want to support more than one controller in a system,
1768         * usb_gadget_driver_{register,unregister}() must change.
1769         */
1770        if (the_controller) {
1771                WARNING(dev, "ignoring %s\n", pci_name(pdev));
1772                return -EBUSY;
1773        }
1774        if (!pdev->irq) {
1775                printk(KERN_ERR "Check PCI %s IRQ setup!\n", pci_name(pdev));
1776                retval = -ENODEV;
1777                goto done;
1778        }
1779
1780        /* alloc, and start init */
1781        dev = kzalloc (sizeof *dev, GFP_KERNEL);
Show full sources