* [pci:endpoint 3/5] drivers/pci/endpoint/pci-epf-core.c:275 pci_epf_alloc_space() error: uninitialized symbol 'dev'.
@ 2024-02-09 17:02 Dan Carpenter
2024-02-09 17:11 ` Manivannan Sadhasivam
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-02-09 17:02 UTC (permalink / raw)
To: oe-kbuild, Niklas Cassel
Cc: lkp, oe-kbuild-all, linux-pci, Manivannan Sadhasivam, Frank Li
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@intel.com/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@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202402100046.9zcFnPl3-lkp@intel.com/
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [pci:endpoint 3/5] drivers/pci/endpoint/pci-epf-core.c:275 pci_epf_alloc_space() error: uninitialized symbol 'dev'.
2024-02-09 17:02 [pci:endpoint 3/5] drivers/pci/endpoint/pci-epf-core.c:275 pci_epf_alloc_space() error: uninitialized symbol 'dev' Dan Carpenter
@ 2024-02-09 17:11 ` Manivannan Sadhasivam
0 siblings, 0 replies; 2+ messages in thread
From: Manivannan Sadhasivam @ 2024-02-09 17:11 UTC (permalink / raw)
To: Dan Carpenter
Cc: oe-kbuild, Niklas Cassel, lkp, oe-kbuild-all, linux-pci, Frank Li
On Fri, Feb 09, 2024 at 08:02:21PM +0300, Dan Carpenter wrote:
> 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@intel.com/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@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202402100046.9zcFnPl3-lkp@intel.com/
>
Thanks for the report. Fixed the issue in offending commit.
- Mani
> 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
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-09 17:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-09 17:02 [pci:endpoint 3/5] drivers/pci/endpoint/pci-epf-core.c:275 pci_epf_alloc_space() error: uninitialized symbol 'dev' Dan Carpenter
2024-02-09 17:11 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox