tree:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 3b2804993d1e9f2b01f4264993009d3e48722e0d
commit: 3c2760b78f90db874401d97e3c17829e2e36f400 [745/1366] fpga: dfl: pci: fix return
value of cci_pci_sriov_configure
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
cppcheck warnings: (new ones prefixed by >>)
drivers/fpga/dfl-pci.c:230:6: warning: The scope of the variable 'ret' can be
reduced. [variableScope]
int ret = 0;
^
drivers/fpga/dfl.h:348:21: warning: 'base' is of type 'void *'. When
using void pointers in calculations, the behaviour is undefined.
[arithOperationsOnVoidPointer]
u64 v = readq(base + DFH);
^
drivers/fpga/dfl.h:356:21: warning: 'base' is of type 'void *'. When
using void pointers in calculations, the behaviour is undefined.
[arithOperationsOnVoidPointer]
u64 v = readq(base + DFH);
^
drivers/fpga/dfl.h:364:48: warning: 'base' is of type 'void *'. When
using void pointers in calculations, the behaviour is undefined.
[arithOperationsOnVoidPointer]
return (u8)FIELD_GET(DFH_REVISION, readq(base + DFH));
^
> drivers/fpga/dfl-pci.c:230:10: warning: Variable 'ret' is
assigned a value that is never used. [unreadVariable]
int ret = 0;
^
vim +/ret +230 drivers/fpga/dfl-pci.c
72ddd9f34040a49 Zhang Yi 2018-06-30 225
bdd4f307956ae7c Wu Hao 2019-08-04 226 static int cci_pci_sriov_configure(struct
pci_dev *pcidev, int num_vfs)
bdd4f307956ae7c Wu Hao 2019-08-04 227 {
bdd4f307956ae7c Wu Hao 2019-08-04 228 struct cci_drvdata *drvdata =
pci_get_drvdata(pcidev);
bdd4f307956ae7c Wu Hao 2019-08-04 229 struct dfl_fpga_cdev *cdev = drvdata->cdev;
bdd4f307956ae7c Wu Hao 2019-08-04 @230 int ret = 0;
bdd4f307956ae7c Wu Hao 2019-08-04 231
bdd4f307956ae7c Wu Hao 2019-08-04 232 if (!num_vfs) {
bdd4f307956ae7c Wu Hao 2019-08-04 233 /*
bdd4f307956ae7c Wu Hao 2019-08-04 234 * disable SRIOV and then put released ports
back to default
bdd4f307956ae7c Wu Hao 2019-08-04 235 * PF access mode.
bdd4f307956ae7c Wu Hao 2019-08-04 236 */
bdd4f307956ae7c Wu Hao 2019-08-04 237 pci_disable_sriov(pcidev);
bdd4f307956ae7c Wu Hao 2019-08-04 238
bdd4f307956ae7c Wu Hao 2019-08-04 239 dfl_fpga_cdev_config_ports_pf(cdev);
bdd4f307956ae7c Wu Hao 2019-08-04 240
bdd4f307956ae7c Wu Hao 2019-08-04 241 } else {
bdd4f307956ae7c Wu Hao 2019-08-04 242 /*
bdd4f307956ae7c Wu Hao 2019-08-04 243 * before enable SRIOV, put released ports
into VF access mode
bdd4f307956ae7c Wu Hao 2019-08-04 244 * first of all.
bdd4f307956ae7c Wu Hao 2019-08-04 245 */
bdd4f307956ae7c Wu Hao 2019-08-04 246 ret = dfl_fpga_cdev_config_ports_vf(cdev,
num_vfs);
bdd4f307956ae7c Wu Hao 2019-08-04 247 if (ret)
bdd4f307956ae7c Wu Hao 2019-08-04 248 return ret;
bdd4f307956ae7c Wu Hao 2019-08-04 249
bdd4f307956ae7c Wu Hao 2019-08-04 250 ret = pci_enable_sriov(pcidev, num_vfs);
3c2760b78f90db8 Xu Yilun 2020-02-25 251 if (ret) {
bdd4f307956ae7c Wu Hao 2019-08-04 252 dfl_fpga_cdev_config_ports_pf(cdev);
3c2760b78f90db8 Xu Yilun 2020-02-25 253 return ret;
3c2760b78f90db8 Xu Yilun 2020-02-25 254 }
bdd4f307956ae7c Wu Hao 2019-08-04 255 }
bdd4f307956ae7c Wu Hao 2019-08-04 256
3c2760b78f90db8 Xu Yilun 2020-02-25 257 return num_vfs;
bdd4f307956ae7c Wu Hao 2019-08-04 258 }
bdd4f307956ae7c Wu Hao 2019-08-04 259
:::::: The code at line 230 was first introduced by commit
:::::: bdd4f307956ae7c80a831aed67b0ddd131537481 fpga: dfl: pci: enable SRIOV support.
:::::: TO: Wu Hao <hao.wu(a)intel.com>
:::::: CC: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org