lkml.org 
[lkml]   [2021]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1 1/3] fpga: mgr: Use standard dev_release for class driver
Hi Russ,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v5.13-rc2 next-20210521]
[cannot apply to xlnx/master]
[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]

url: https://github.com/0day-ci/linux/commits/Russ-Weight/fpga-Use-standard-class-dev_release-function/20210522-205631
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd860052c99b1e088352bdd4fb7aef46f8d2ef47
config: x86_64-randconfig-a014-20210522 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project e84a9b9bb3051c35dea993cdad7b3d2575638f85)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/fe4ee184f8a9b9acbf00d536ec38d8d793f8dcee
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Russ-Weight/fpga-Use-standard-class-dev_release-function/20210522-205631
git checkout fe4ee184f8a9b9acbf00d536ec38d8d793f8dcee
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

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

All warnings (new ones prefixed by >>):

>> drivers/fpga/fpga-mgr.c:581:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (id < 0)
^~~~~~
drivers/fpga/fpga-mgr.c:620:17: note: uninitialized use occurs here
return ERR_PTR(ret);
^~~
drivers/fpga/fpga-mgr.c:581:2: note: remove the 'if' if its condition is always false
if (id < 0)
^~~~~~~~~~~
drivers/fpga/fpga-mgr.c:562:13: note: initialize the variable 'ret' to silence this warning
int id, ret;
^
= 0
1 warning generated.


vim +581 drivers/fpga/fpga-mgr.c

ebf877a51ad7b6 Alan Tull 2017-11-15 547
6a8c3be7ec8eb3 Alan Tull 2015-10-07 548 /**
fe4ee184f8a9b9 Russ Weight 2021-05-20 549 * fpga_mgr_register - create and register a FPGA manager struct
6a8c3be7ec8eb3 Alan Tull 2015-10-07 550 * @dev: fpga manager device from pdev
6a8c3be7ec8eb3 Alan Tull 2015-10-07 551 * @name: fpga manager name
6a8c3be7ec8eb3 Alan Tull 2015-10-07 552 * @mops: pointer to structure of fpga manager ops
6a8c3be7ec8eb3 Alan Tull 2015-10-07 553 * @priv: fpga manager private data
6a8c3be7ec8eb3 Alan Tull 2015-10-07 554 *
fe4ee184f8a9b9 Russ Weight 2021-05-20 555 * Returns a struct fpga_manager pointer on success, or ERR_PTR() on error.
6a8c3be7ec8eb3 Alan Tull 2015-10-07 556 */
fe4ee184f8a9b9 Russ Weight 2021-05-20 557 struct fpga_manager *
fe4ee184f8a9b9 Russ Weight 2021-05-20 558 fpga_mgr_register(struct device *dev, const char *name,
fe4ee184f8a9b9 Russ Weight 2021-05-20 559 const struct fpga_manager_ops *mops, void *priv)
6a8c3be7ec8eb3 Alan Tull 2015-10-07 560 {
6a8c3be7ec8eb3 Alan Tull 2015-10-07 561 struct fpga_manager *mgr;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 562 int id, ret;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 563
baa6d396635129 Jason Gunthorpe 2017-02-01 564 if (!mops || !mops->write_complete || !mops->state ||
baa6d396635129 Jason Gunthorpe 2017-02-01 565 !mops->write_init || (!mops->write && !mops->write_sg) ||
baa6d396635129 Jason Gunthorpe 2017-02-01 566 (mops->write && mops->write_sg)) {
6a8c3be7ec8eb3 Alan Tull 2015-10-07 567 dev_err(dev, "Attempt to register without fpga_manager_ops\n");
fe4ee184f8a9b9 Russ Weight 2021-05-20 568 return ERR_PTR(-EINVAL);
6a8c3be7ec8eb3 Alan Tull 2015-10-07 569 }
6a8c3be7ec8eb3 Alan Tull 2015-10-07 570
6a8c3be7ec8eb3 Alan Tull 2015-10-07 571 if (!name || !strlen(name)) {
6a8c3be7ec8eb3 Alan Tull 2015-10-07 572 dev_err(dev, "Attempt to register with no name!\n");
fe4ee184f8a9b9 Russ Weight 2021-05-20 573 return ERR_PTR(-EINVAL);
6a8c3be7ec8eb3 Alan Tull 2015-10-07 574 }
6a8c3be7ec8eb3 Alan Tull 2015-10-07 575
6a8c3be7ec8eb3 Alan Tull 2015-10-07 576 mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
6a8c3be7ec8eb3 Alan Tull 2015-10-07 577 if (!mgr)
fe4ee184f8a9b9 Russ Weight 2021-05-20 578 return ERR_PTR(-ENOMEM);
6a8c3be7ec8eb3 Alan Tull 2015-10-07 579
6a8c3be7ec8eb3 Alan Tull 2015-10-07 580 id = ida_simple_get(&fpga_mgr_ida, 0, 0, GFP_KERNEL);
88aaab9218f87c Tom Rix 2020-06-08 @581 if (id < 0)
6a8c3be7ec8eb3 Alan Tull 2015-10-07 582 goto error_kfree;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 583
6a8c3be7ec8eb3 Alan Tull 2015-10-07 584 mutex_init(&mgr->ref_mutex);
6a8c3be7ec8eb3 Alan Tull 2015-10-07 585
6a8c3be7ec8eb3 Alan Tull 2015-10-07 586 mgr->name = name;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 587 mgr->mops = mops;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 588 mgr->priv = priv;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 589
6a8c3be7ec8eb3 Alan Tull 2015-10-07 590 mgr->dev.class = fpga_mgr_class;
845089bbf589be Alan Tull 2017-11-15 591 mgr->dev.groups = mops->groups;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 592 mgr->dev.parent = dev;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 593 mgr->dev.of_node = dev->of_node;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 594 mgr->dev.id = id;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 595
6a8c3be7ec8eb3 Alan Tull 2015-10-07 596 ret = dev_set_name(&mgr->dev, "fpga%d", id);
07687c031d14a1 Alan Tull 2015-10-29 597 if (ret)
07687c031d14a1 Alan Tull 2015-10-29 598 goto error_device;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 599
7085e2a94f7df5 Alan Tull 2018-05-16 600 /*
7085e2a94f7df5 Alan Tull 2018-05-16 601 * Initialize framework state by requesting low level driver read state
7085e2a94f7df5 Alan Tull 2018-05-16 602 * from device. FPGA may be in reset mode or may have been programmed
7085e2a94f7df5 Alan Tull 2018-05-16 603 * by bootloader or EEPROM.
7085e2a94f7df5 Alan Tull 2018-05-16 604 */
7085e2a94f7df5 Alan Tull 2018-05-16 605 mgr->state = mgr->mops->state(mgr);
7085e2a94f7df5 Alan Tull 2018-05-16 606
fe4ee184f8a9b9 Russ Weight 2021-05-20 607 ret = device_register(&mgr->dev);
fe4ee184f8a9b9 Russ Weight 2021-05-20 608 if (ret) {
fe4ee184f8a9b9 Russ Weight 2021-05-20 609 put_device(&mgr->dev);
fe4ee184f8a9b9 Russ Weight 2021-05-20 610 return ERR_PTR(ret);
fe4ee184f8a9b9 Russ Weight 2021-05-20 611 }
6a8c3be7ec8eb3 Alan Tull 2015-10-07 612
fe4ee184f8a9b9 Russ Weight 2021-05-20 613 return mgr;
6a8c3be7ec8eb3 Alan Tull 2015-10-07 614
6a8c3be7ec8eb3 Alan Tull 2015-10-07 615 error_device:
fe4ee184f8a9b9 Russ Weight 2021-05-20 616 ida_simple_remove(&fpga_mgr_ida, id);
fe4ee184f8a9b9 Russ Weight 2021-05-20 617 error_kfree:
fe4ee184f8a9b9 Russ Weight 2021-05-20 618 kfree(mgr);
6a8c3be7ec8eb3 Alan Tull 2015-10-07 619
fe4ee184f8a9b9 Russ Weight 2021-05-20 620 return ERR_PTR(ret);
6a8c3be7ec8eb3 Alan Tull 2015-10-07 621 }
6a8c3be7ec8eb3 Alan Tull 2015-10-07 622 EXPORT_SYMBOL_GPL(fpga_mgr_register);
6a8c3be7ec8eb3 Alan Tull 2015-10-07 623

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-05-22 22:37    [W:0.086 / U:3.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site