Showing error 1852

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/scsi/3w-9xxx.c
Line in file: 2029
Project: Linux Kernel
Project version: 2.6.28
Tools: Smatch (1.59)
Entered: 2013-09-11 08:47:26 UTC


Source:

1999};
2000
2001/* This function will probe and initialize a card */
2002static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
2003{
2004        struct Scsi_Host *host = NULL;
2005        TW_Device_Extension *tw_dev;
2006        unsigned long mem_addr, mem_len;
2007        int retval = -ENODEV;
2008
2009        retval = pci_enable_device(pdev);
2010        if (retval) {
2011                TW_PRINTK(host, TW_DRIVER, 0x34, "Failed to enable pci device");
2012                goto out_disable_device;
2013        }
2014
2015        pci_set_master(pdev);
2016        pci_try_set_mwi(pdev);
2017
2018        if (pci_set_dma_mask(pdev, DMA_64BIT_MASK)
2019            || pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))
2020                if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)
2021                    || pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK)) {
2022                        TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");
2023                        retval = -ENODEV;
2024                        goto out_disable_device;
2025                }
2026
2027        host = scsi_host_alloc(&driver_template, sizeof(TW_Device_Extension));
2028        if (!host) {
2029                TW_PRINTK(host, TW_DRIVER, 0x24, "Failed to allocate memory for device extension");
2030                retval = -ENOMEM;
2031                goto out_disable_device;
2032        }
2033        tw_dev = (TW_Device_Extension *)host->hostdata;
2034
2035        /* Save values to device extension */
2036        tw_dev->host = host;
2037        tw_dev->tw_pci_dev = pdev;
2038
2039        if (twa_initialize_device_extension(tw_dev)) {
Show full sources