LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Kishon Vijay Abraham I <kishon@ti.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	Bjorn Helgaas <helgaas@kernel.org>,
	linux-kernel@vger.kernel.org,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Subject: [lpieralisi-pci:pci/endpoint 2/8] drivers/pci/endpoint/pci-epf-core.c:169 pci_epf_add_vepf() warn: inconsistent returns '&epf_pf->lock'.
Date: Mon, 23 Aug 2021 11:36:38 +0300	[thread overview]
Message-ID: <202108181550.NrTSW4nu-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/lpieralisi/pci.git pci/endpoint
head:   805ff686a143d77d44ffbb8e34ec3c08e65cb6c4
commit: b64215ff2b5e9fef9208ba652590c51631a0ac1e [2/8] PCI: endpoint: Add support to add virtual function in endpoint core
config: i386-randconfig-m021-20210818 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/pci/endpoint/pci-epf-core.c:169 pci_epf_add_vepf() warn: inconsistent returns '&epf_pf->lock'.

vim +169 drivers/pci/endpoint/pci-epf-core.c

b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  141  int pci_epf_add_vepf(struct pci_epf *epf_pf, struct pci_epf *epf_vf)
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  142  {
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  143  	u32 vfunc_no;
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  144  
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  145  	if (IS_ERR_OR_NULL(epf_pf) || IS_ERR_OR_NULL(epf_vf))
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  146  		return -EINVAL;
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  147  
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  148  	if (epf_pf->epc || epf_vf->epc || epf_vf->epf_pf)
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  149  		return -EBUSY;
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  150  
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  151  	if (epf_pf->sec_epc || epf_vf->sec_epc)
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  152  		return -EBUSY;
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  153  
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  154  	mutex_lock(&epf_pf->lock);
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^

b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  155  	vfunc_no = find_first_zero_bit(&epf_pf->vfunction_num_map,
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  156  				       BITS_PER_LONG);
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  157  	if (vfunc_no >= BITS_PER_LONG)
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  158  		return -EINVAL;
                                                                ^^^^^^^^^^^^^^
Needs unlock before return.

b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  159  
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  160  	set_bit(vfunc_no, &epf_pf->vfunction_num_map);
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  161  	epf_vf->vfunc_no = vfunc_no;
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  162  
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  163  	epf_vf->epf_pf = epf_pf;
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  164  	epf_vf->is_vf = true;
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  165  
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  166  	list_add_tail(&epf_vf->list, &epf_pf->pci_vepf);
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  167  	mutex_unlock(&epf_pf->lock);
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  168  
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11 @169  	return 0;
b64215ff2b5e9f Kishon Vijay Abraham I 2021-08-11  170  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


                 reply	other threads:[~2021-08-23  8:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202108181550.NrTSW4nu-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=helgaas@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=lorenzo.pieralisi@arm.com \
    --subject='Re: [lpieralisi-pci:pci/endpoint 2/8] drivers/pci/endpoint/pci-epf-core.c:169 pci_epf_add_vepf() warn: inconsistent returns '\''&epf_pf->lock'\''.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).