All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [ti:ti-rt-linux-5.10.y 3637/3763] drivers/pci/endpoint/pci-epf-core.c:169 pci_epf_add_vepf() warn: inconsistent returns '&epf_pf->lock'.
Date: Wed, 21 Apr 2021 20:22:08 +0800	[thread overview]
Message-ID: <202104212000.qTQtQRzN-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4570 bytes --]

CC: kbuild-all(a)lists.01.org
TO: Kishon Vijay Abraham I <kishon@ti.com>
CC: Vignesh Raghavendra <vigneshr@ti.com>

tree:   git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git ti-rt-linux-5.10.y
head:   995afcca2f9a28d16436145821b35c19fc180021
commit: 0cf43e35b1743dc43574089fcf3ff71d8cd2ae39 [3637/3763] PCI: endpoint: Add support to add virtual function in endpoint core
:::::: branch date: 5 hours ago
:::::: commit date: 3 weeks ago
config: x86_64-randconfig-m001-20210421 (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

5e8cb4033807e3 Kishon Vijay Abraham I 2017-04-10  130  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  131  /**
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  132   * pci_epf_add_vepf() - associate virtual EP function to physical EP function
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  133   * @epf_pf: the physical EP function to which the virtual EP function should be
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  134   *   associated
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  135   * @epf_vf: the virtual EP function to be added
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  136   *
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  137   * A physical endpoint function can be associated with multiple virtual
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  138   * endpoint functions. Invoke pci_epf_add_epf() to add a virtual PCI endpoint
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  139   * function to a physical PCI endpoint function.
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  140   */
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  141  int pci_epf_add_vepf(struct pci_epf *epf_pf, struct pci_epf *epf_vf)
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  142  {
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  143  	u32 vfunc_no;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  144  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  145  	if (IS_ERR_OR_NULL(epf_pf) || IS_ERR_OR_NULL(epf_vf))
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  146  		return -EINVAL;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  147  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  148  	if (epf_pf->epc || epf_vf->epc || epf_vf->epf_pf)
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  149  		return -EBUSY;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  150  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  151  	if (epf_pf->sec_epc || epf_vf->sec_epc)
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  152  		return -EBUSY;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  153  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  154  	mutex_lock(&epf_pf->lock);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  155  	vfunc_no = find_first_zero_bit(&epf_pf->vfunction_num_map,
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  156  				       BITS_PER_LONG);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  157  	if (vfunc_no >= BITS_PER_LONG)
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  158  		return -EINVAL;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  159  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  160  	set_bit(vfunc_no, &epf_pf->vfunction_num_map);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  161  	epf_vf->vfunc_no = vfunc_no;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  162  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  163  	epf_vf->epf_pf = epf_pf;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  164  	epf_vf->is_vf = true;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  165  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  166  	list_add_tail(&epf_vf->list, &epf_pf->pci_vepf);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  167  	mutex_unlock(&epf_pf->lock);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  168  
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30 @169  	return 0;
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  170  }
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  171  EXPORT_SYMBOL_GPL(pci_epf_add_vepf);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  172  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32792 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [ti:ti-rt-linux-5.10.y 3637/3763] drivers/pci/endpoint/pci-epf-core.c:169 pci_epf_add_vepf() warn: inconsistent returns '&epf_pf->lock'.
Date: Thu, 29 Apr 2021 12:10:03 +0300	[thread overview]
Message-ID: <202104212000.qTQtQRzN-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3377 bytes --]

tree:   git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git ti-rt-linux-5.10.y
head:   995afcca2f9a28d16436145821b35c19fc180021
commit: 0cf43e35b1743dc43574089fcf3ff71d8cd2ae39 [3637/3763] PCI: endpoint: Add support to add virtual function in endpoint core
config: x86_64-randconfig-m001-20210421 (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

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

0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  155  	vfunc_no = find_first_zero_bit(&epf_pf->vfunction_num_map,
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  156  				       BITS_PER_LONG);
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  157  	if (vfunc_no >= BITS_PER_LONG)
0cf43e35b1743d Kishon Vijay Abraham I 2021-03-30  158  		return -EINVAL;
                                                                ^^^^^^^^^^^^^^
Unlock before returning

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

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

             reply	other threads:[~2021-04-21 12:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 12:22 kernel test robot [this message]
2021-04-29  9:10 ` [ti:ti-rt-linux-5.10.y 3637/3763] drivers/pci/endpoint/pci-epf-core.c:169 pci_epf_add_vepf() warn: inconsistent returns '&epf_pf->lock' Dan Carpenter

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=202104212000.qTQtQRzN-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.