[mcgrof-next:20210708-block-fixes-v2 61/89] drivers/md/md.c:9592:42: error: incompatible function pointer types passing 'void (dev_t)' (aka 'void (unsigned int)') to parameter of type 'int (*)(dev_t)' (aka 'int (*)(unsigned int)')

From: kernel test robot
Date: Thu Jul 15 2021 - 09:17:00 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git 20210708-block-fixes-v2
head: db0174e39de7dc941f158ce53ee3af95b1635b62
commit: b253de076cda99b4968dd20b1a9702de24376152 [61/89] block: make __register_blkdev() return an error
config: powerpc-randconfig-r005-20210715 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 0e49c54a8cbd3e779e5526a5888c683c01cc3c50)
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 powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/commit/?id=b253de076cda99b4968dd20b1a9702de24376152
git remote add mcgrof-next https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git
git fetch --no-tags mcgrof-next 20210708-block-fixes-v2
git checkout b253de076cda99b4968dd20b1a9702de24376152
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc

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

All error/warnings (new ones prefixed by >>):

>> drivers/block/floppy.c:4532:7: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (floppy_alloc_disk(drive, type) == 0) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/floppy.c:4540:9: note: uninitialized use occurs here
return err;
^~~
drivers/block/floppy.c:4532:3: note: remove the 'if' if its condition is always true
if (floppy_alloc_disk(drive, type) == 0) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/floppy.c:4531:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (!disks[drive][type]) {
^~~~~~~~~~~~~~~~~~~
drivers/block/floppy.c:4540:9: note: uninitialized use occurs here
return err;
^~~
drivers/block/floppy.c:4531:2: note: remove the 'if' if its condition is always true
if (!disks[drive][type]) {
^~~~~~~~~~~~~~~~~~~~~~~~~
drivers/block/floppy.c:4524:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
2 warnings generated.
--
>> drivers/md/md.c:9592:42: error: incompatible function pointer types passing 'void (dev_t)' (aka 'void (unsigned int)') to parameter of type 'int (*)(dev_t)' (aka 'int (*)(unsigned int)') [-Werror,-Wincompatible-function-pointer-types]
ret = __register_blkdev(MD_MAJOR, "md", md_probe);
^~~~~~~~
include/linux/genhd.h:315:9: note: passing argument to parameter 'probe' here
int (*probe)(dev_t devt));
^
drivers/md/md.c:9596:36: error: incompatible function pointer types passing 'void (dev_t)' (aka 'void (unsigned int)') to parameter of type 'int (*)(dev_t)' (aka 'int (*)(unsigned int)') [-Werror,-Wincompatible-function-pointer-types]
ret = __register_blkdev(0, "mdp", md_probe);
^~~~~~~~
include/linux/genhd.h:315:9: note: passing argument to parameter 'probe' here
int (*probe)(dev_t devt));
^
2 errors generated.


vim +9592 drivers/md/md.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 9575
75c96f85845a67 Adrian Bunk 2005-05-05 9576 static int __init md_init(void)
^1da177e4c3f41 Linus Torvalds 2005-04-16 9577 {
e804ac780e2f01 Tejun Heo 2010-10-15 9578 int ret = -ENOMEM;
e804ac780e2f01 Tejun Heo 2010-10-15 9579
ada609ee2ac2e0 Tejun Heo 2011-01-25 9580 md_wq = alloc_workqueue("md", WQ_MEM_RECLAIM, 0);
e804ac780e2f01 Tejun Heo 2010-10-15 9581 if (!md_wq)
e804ac780e2f01 Tejun Heo 2010-10-15 9582 goto err_wq;
e804ac780e2f01 Tejun Heo 2010-10-15 9583
e804ac780e2f01 Tejun Heo 2010-10-15 9584 md_misc_wq = alloc_workqueue("md_misc", 0, 0);
e804ac780e2f01 Tejun Heo 2010-10-15 9585 if (!md_misc_wq)
e804ac780e2f01 Tejun Heo 2010-10-15 9586 goto err_misc_wq;
e804ac780e2f01 Tejun Heo 2010-10-15 9587
cc1ffe61c026e2 Guoqing Jiang 2020-04-04 9588 md_rdev_misc_wq = alloc_workqueue("md_rdev_misc", 0, 0);
cf0b9b4821a295 Guoqing Jiang 2020-10-08 9589 if (!md_rdev_misc_wq)
cc1ffe61c026e2 Guoqing Jiang 2020-04-04 9590 goto err_rdev_misc_wq;
cc1ffe61c026e2 Guoqing Jiang 2020-04-04 9591
28144f9998e047 Christoph Hellwig 2020-10-29 @9592 ret = __register_blkdev(MD_MAJOR, "md", md_probe);
28144f9998e047 Christoph Hellwig 2020-10-29 9593 if (ret < 0)
e804ac780e2f01 Tejun Heo 2010-10-15 9594 goto err_md;
e804ac780e2f01 Tejun Heo 2010-10-15 9595
28144f9998e047 Christoph Hellwig 2020-10-29 9596 ret = __register_blkdev(0, "mdp", md_probe);
28144f9998e047 Christoph Hellwig 2020-10-29 9597 if (ret < 0)
e804ac780e2f01 Tejun Heo 2010-10-15 9598 goto err_mdp;
e804ac780e2f01 Tejun Heo 2010-10-15 9599 mdp_major = ret;
e804ac780e2f01 Tejun Heo 2010-10-15 9600
^1da177e4c3f41 Linus Torvalds 2005-04-16 9601 register_reboot_notifier(&md_notifier);
0b4d414714f0d2 Eric W. Biederman 2007-02-14 9602 raid_table_header = register_sysctl_table(raid_root_table);
^1da177e4c3f41 Linus Torvalds 2005-04-16 9603
^1da177e4c3f41 Linus Torvalds 2005-04-16 9604 md_geninit();
d710e138126000 NeilBrown 2008-10-13 9605 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 9606
e804ac780e2f01 Tejun Heo 2010-10-15 9607 err_mdp:
e804ac780e2f01 Tejun Heo 2010-10-15 9608 unregister_blkdev(MD_MAJOR, "md");
e804ac780e2f01 Tejun Heo 2010-10-15 9609 err_md:
cc1ffe61c026e2 Guoqing Jiang 2020-04-04 9610 destroy_workqueue(md_rdev_misc_wq);
cc1ffe61c026e2 Guoqing Jiang 2020-04-04 9611 err_rdev_misc_wq:
e804ac780e2f01 Tejun Heo 2010-10-15 9612 destroy_workqueue(md_misc_wq);
e804ac780e2f01 Tejun Heo 2010-10-15 9613 err_misc_wq:
e804ac780e2f01 Tejun Heo 2010-10-15 9614 destroy_workqueue(md_wq);
e804ac780e2f01 Tejun Heo 2010-10-15 9615 err_wq:
e804ac780e2f01 Tejun Heo 2010-10-15 9616 return ret;
e804ac780e2f01 Tejun Heo 2010-10-15 9617 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 9618

:::::: The code at line 9592 was first introduced by commit
:::::: 28144f9998e047a9bac31421914335c6bc6eaa67 md: use __register_blkdev to allocate devices on demand

:::::: TO: Christoph Hellwig <hch@xxxxxx>
:::::: CC: Jens Axboe <axboe@xxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip