CC: kbuild-...@lists.01.org
TO: Jason Gunthorpe <j...@nvidia.com>

tree:   https://github.com/jgunthorpe/linux pr/3
head:   c8835ec0e0ca38b1a004972aea9d2df33ad20c7e
commit: 162ed1ef32cb09b866830f11c25f72eb28dbb032 [36/65] vfio/mdev: Allow the 
mdev_parent_ops to specify the device driver to bind
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: i386-randconfig-m021-20210426 (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 <l...@intel.com>
Reported-by: Dan Carpenter <dan.carpen...@oracle.com>

smatch warnings:
drivers/vfio/mdev/mdev_core.c:288 mdev_bind_driver() warn: ignoring unreachable 
code.

vim +288 drivers/vfio/mdev/mdev_core.c

7b96953bc640b6 Kirti Wankhede  2016-11-17  257  
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  258  /*
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  259   * mdev drivers can refuse to 
bind during probe(), in this case we want to fail
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  260   * the creation of the mdev all 
the way back to sysfs. This is a weird model
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  261   * that doesn't fit in the 
driver core well, nor does it seem to appear any
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  262   * place else in the kernel, so 
use a simple hack.
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  263   */
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  264  static int 
mdev_bind_driver(struct mdev_device *mdev)
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  265  {
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  266          struct mdev_driver *drv 
= mdev->type->parent->ops->device_driver;
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  267          int ret;
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  268  
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  269          if (!drv)
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  270                  drv = 
&vfio_mdev_driver;
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  271  
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  272          while (1) {
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  273                  
device_lock(&mdev->dev);
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  274                  if 
(mdev->dev.driver == &drv->driver) {
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  275                          ret = 0;
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  276                          goto 
out_unlock;
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  277                  }
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  278                  if 
(mdev->probe_err) {
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  279                          ret = 
mdev->probe_err;
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  280                          goto 
out_unlock;
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  281                  }
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  282                  
device_unlock(&mdev->dev);
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  283                  ret = 
device_attach(&mdev->dev);
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  284                  if (ret)
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  285                          return 
ret;
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  286                  mdev->probe_err 
= -EINVAL;
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  287          }
162ed1ef32cb09 Jason Gunthorpe 2021-02-26 @288          return 0;
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  289  
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  290  out_unlock:
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  291          
device_unlock(&mdev->dev);
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  292          return ret;
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  293  }
162ed1ef32cb09 Jason Gunthorpe 2021-02-26  294  

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to