2022-10-28 16:30:58

by Frank Li

[permalink] [raw]
Subject: [PATCH v14 3/7] PCI: endpoint: pci-epf-vntb: fix call pci_epc_mem_free_addr at err path

From: Frank Li <[email protected]>

Replace pci_epc_mem_free_addr() with pci_epf_free_space() at error handle
path to match pci_epf_alloc_space().

Signed-off-by: Frank Li <[email protected]>
---
drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
index 1863006cc36c..191924a83454 100644
--- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
+++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
@@ -571,7 +571,7 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb)
return ret;

err_alloc_peer_mem:
- pci_epc_mem_free_addr(ntb->epf->epc, epf_bar->phys_addr, mw_addr, epf_bar->size);
+ pci_epf_free_space(ntb->epf, mw_addr, barno, 0);
return -1;
}

--
2.34.1



2022-11-01 11:28:00

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v14 3/7] PCI: endpoint: pci-epf-vntb: fix call pci_epc_mem_free_addr at err path

Hi Frank,

I love your patch! Perhaps something to improve:

[auto build test WARNING on jonmason-ntb/ntb-next]
[also build test WARNING on linus/master v6.1-rc3 next-20221101]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Frank-Li/pci-epf-vntb-clean-up/20221029-000245
base: https://github.com/jonmason/ntb ntb-next
patch link: https://lore.kernel.org/r/20221028155703.318928-4-Frank.Li%40nxp.com
patch subject: [PATCH v14 3/7] PCI: endpoint: pci-epf-vntb: fix call pci_epc_mem_free_addr at err path
config: ia64-randconfig-s043-20221031
compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/20ecc991a4fdac34a3b4d75fb03624292f3748c6
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Frank-Li/pci-epf-vntb-clean-up/20221029-000245
git checkout 20ecc991a4fdac34a3b4d75fb03624292f3748c6
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/pci/controller/ drivers/pci/endpoint/functions/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

sparse warnings: (new ones prefixed by >>)
drivers/pci/endpoint/functions/pci-epf-vntb.c:556:17: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __iomem *mw_addr @@ got void * @@
drivers/pci/endpoint/functions/pci-epf-vntb.c:556:17: sparse: expected void [noderef] __iomem *mw_addr
drivers/pci/endpoint/functions/pci-epf-vntb.c:556:17: sparse: got void *
>> drivers/pci/endpoint/functions/pci-epf-vntb.c:574:38: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *mw_addr @@
drivers/pci/endpoint/functions/pci-epf-vntb.c:574:38: sparse: expected void *addr
drivers/pci/endpoint/functions/pci-epf-vntb.c:574:38: sparse: got void [noderef] __iomem *mw_addr
drivers/pci/endpoint/functions/pci-epf-vntb.c:590:41: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *epf_db @@
drivers/pci/endpoint/functions/pci-epf-vntb.c:590:41: sparse: expected void *addr
drivers/pci/endpoint/functions/pci-epf-vntb.c:590:41: sparse: got void [noderef] __iomem *epf_db
drivers/pci/endpoint/functions/pci-epf-vntb.c:1127:33: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] __iomem *base @@ got struct epf_ntb_ctrl *reg @@
drivers/pci/endpoint/functions/pci-epf-vntb.c:1127:33: sparse: expected void [noderef] __iomem *base
drivers/pci/endpoint/functions/pci-epf-vntb.c:1127:33: sparse: got struct epf_ntb_ctrl *reg
drivers/pci/endpoint/functions/pci-epf-vntb.c:1138:33: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] __iomem *base @@ got struct epf_ntb_ctrl *reg @@
drivers/pci/endpoint/functions/pci-epf-vntb.c:1138:33: sparse: expected void [noderef] __iomem *base
drivers/pci/endpoint/functions/pci-epf-vntb.c:1138:33: sparse: got struct epf_ntb_ctrl *reg
drivers/pci/endpoint/functions/pci-epf-vntb.c:1149:33: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] __iomem *base @@ got struct epf_ntb_ctrl *reg @@
drivers/pci/endpoint/functions/pci-epf-vntb.c:1149:33: sparse: expected void [noderef] __iomem *base
drivers/pci/endpoint/functions/pci-epf-vntb.c:1149:33: sparse: got struct epf_ntb_ctrl *reg
drivers/pci/endpoint/functions/pci-epf-vntb.c:1161:33: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] __iomem *base @@ got struct epf_ntb_ctrl *reg @@
drivers/pci/endpoint/functions/pci-epf-vntb.c:1161:33: sparse: expected void [noderef] __iomem *base
drivers/pci/endpoint/functions/pci-epf-vntb.c:1161:33: sparse: got struct epf_ntb_ctrl *reg

vim +574 drivers/pci/endpoint/functions/pci-epf-vntb.c

523
524 /**
525 * epf_ntb_db_bar_init() - Configure Doorbell window BARs
526 * @ntb: NTB device that facilitates communication between HOST and VHOST
527 *
528 * Returns: Zero for success, or an error code in case of failure
529 */
530 static int epf_ntb_db_bar_init(struct epf_ntb *ntb)
531 {
532 const struct pci_epc_features *epc_features;
533 u32 align;
534 struct device *dev = &ntb->epf->dev;
535 int ret;
536 struct pci_epf_bar *epf_bar;
537 void __iomem *mw_addr;
538 enum pci_barno barno;
539 size_t size = 4 * ntb->db_count;
540
541 epc_features = pci_epc_get_features(ntb->epf->epc,
542 ntb->epf->func_no,
543 ntb->epf->vfunc_no);
544 align = epc_features->align;
545
546 if (size < 128)
547 size = 128;
548
549 if (align)
550 size = ALIGN(size, align);
551 else
552 size = roundup_pow_of_two(size);
553
554 barno = ntb->epf_ntb_bar[BAR_DB];
555
556 mw_addr = pci_epf_alloc_space(ntb->epf, size, barno, align, 0);
557 if (!mw_addr) {
558 dev_err(dev, "Failed to allocate OB address\n");
559 return -ENOMEM;
560 }
561
562 ntb->epf_db = mw_addr;
563
564 epf_bar = &ntb->epf->bar[barno];
565
566 ret = pci_epc_set_bar(ntb->epf->epc, ntb->epf->func_no, ntb->epf->vfunc_no, epf_bar);
567 if (ret) {
568 dev_err(dev, "Doorbell BAR set failed\n");
569 goto err_alloc_peer_mem;
570 }
571 return ret;
572
573 err_alloc_peer_mem:
> 574 pci_epf_free_space(ntb->epf, mw_addr, barno, 0);
575 return -1;
576 }
577

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (6.40 kB)
config (159.73 kB)
Download all attachments

2022-11-01 12:33:21

by Manivannan Sadhasivam

[permalink] [raw]
Subject: Re: [PATCH v14 3/7] PCI: endpoint: pci-epf-vntb: fix call pci_epc_mem_free_addr at err path

On Fri, Oct 28, 2022 at 11:56:59AM -0400, Frank Li wrote:
> From: Frank Li <[email protected]>
>
> Replace pci_epc_mem_free_addr() with pci_epf_free_space() at error handle
> path to match pci_epf_alloc_space().
>
> Signed-off-by: Frank Li <[email protected]>

If this is a fix, then Fixes tag needs to be included.

Thanks,
Mani

> ---
> drivers/pci/endpoint/functions/pci-epf-vntb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> index 1863006cc36c..191924a83454 100644
> --- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
> +++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
> @@ -571,7 +571,7 @@ static int epf_ntb_db_bar_init(struct epf_ntb *ntb)
> return ret;
>
> err_alloc_peer_mem:
> - pci_epc_mem_free_addr(ntb->epf->epc, epf_bar->phys_addr, mw_addr, epf_bar->size);
> + pci_epf_free_space(ntb->epf, mw_addr, barno, 0);
> return -1;
> }
>
> --
> 2.34.1
>

--
மணிவண்ணன் சதாசிவம்