[pci:endpoint 3/5] drivers/pci/endpoint/pci-epf-core.c:275 pci_epf_alloc_space() error: uninitialized symbol 'dev'.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git endpoint
head:   f7bcec825e728e0baecf96118e36c8afb7b93f8a
commit: 6441639b8a253254b00d7ccfbc2c9c67a8f42d10 [3/5] PCI: endpoint: Improve pci_epf_alloc_space() API
config: x86_64-randconfig-161-20240209 (https://download.01.org/0day-ci/archive/20240210/202402100046.9zcFnPl3-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202402100046.9zcFnPl3-lkp@xxxxxxxxx/

smatch warnings:
drivers/pci/endpoint/pci-epf-core.c:275 pci_epf_alloc_space() error: uninitialized symbol 'dev'.

vim +/dev +275 drivers/pci/endpoint/pci-epf-core.c

2a9a801620efac Kishon Vijay Abraham I 2019-03-25  259  void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar,
e891becdccaa90 Niklas Cassel          2024-02-07  260  			  const struct pci_epc_features *epc_features,
e891becdccaa90 Niklas Cassel          2024-02-07  261  			  enum pci_epc_interface_type type)
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  262  {
6441639b8a2532 Niklas Cassel          2024-02-07  263  	u64 bar_fixed_size = epc_features->bar_fixed_size[bar];
e891becdccaa90 Niklas Cassel          2024-02-07  264  	size_t align = epc_features->align;
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  265  	struct pci_epf_bar *epf_bar;
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  266  	dma_addr_t phys_addr;
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  267  	struct pci_epc *epc;
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  268  	struct device *dev;
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  269  	void *space;
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  270  
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  271  	if (size < 128)
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  272  		size = 128;
2a9a801620efac Kishon Vijay Abraham I 2019-03-25  273  
6441639b8a2532 Niklas Cassel          2024-02-07  274  	if (bar_fixed_size && size > bar_fixed_size) {
6441639b8a2532 Niklas Cassel          2024-02-07 @275  		dev_err(dev, "requested BAR size is larger than fixed size\n");

"dev" is uninitialized.

6441639b8a2532 Niklas Cassel          2024-02-07  276  		return NULL;
6441639b8a2532 Niklas Cassel          2024-02-07  277  	}
6441639b8a2532 Niklas Cassel          2024-02-07  278  
6441639b8a2532 Niklas Cassel          2024-02-07  279  	if (bar_fixed_size)
6441639b8a2532 Niklas Cassel          2024-02-07  280  		size = bar_fixed_size;
6441639b8a2532 Niklas Cassel          2024-02-07  281  
2a9a801620efac Kishon Vijay Abraham I 2019-03-25  282  	if (align)
2a9a801620efac Kishon Vijay Abraham I 2019-03-25  283  		size = ALIGN(size, align);
2a9a801620efac Kishon Vijay Abraham I 2019-03-25  284  	else
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  285  		size = roundup_pow_of_two(size);
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  286  
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  287  	if (type == PRIMARY_INTERFACE) {
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  288  		epc = epf->epc;
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  289  		epf_bar = epf->bar;
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  290  	} else {
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  291  		epc = epf->sec_epc;
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  292  		epf_bar = epf->sec_epc_bar;
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  293  	}
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  294  
63840ff5322373 Kishon Vijay Abraham I 2021-02-02  295  	dev = epc->dev.parent;
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  296  	space = dma_alloc_coherent(dev, size, &phys_addr, GFP_KERNEL);
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  297  	if (!space) {
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  298  		dev_err(dev, "failed to allocate mem space\n");
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  299  		return NULL;
5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  300  	}

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki





[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux