Re: [bug report] dmaengine: idxd: move dsa_drv support to compatible mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 7/23/2021 6:35 AM, Dan Carpenter wrote:
Hello Dave Jiang,

The patch 6e7f3ee97bbe: "dmaengine: idxd: move dsa_drv support to
compatible mode" from Jul 15, 2021, leads to the following static
checker warning:

	drivers/dma/idxd/compat.c:66 bind_store()
	error: uninitialized symbol 'alt_drv'.


Thanks Dan! This patch should make static checker happy:

https://lore.kernel.org/dmaengine/162689250332.2114335.636367120454420852.stgit@xxxxxxxxxxxxxxxxxxxxxxxxxx/T/#u



drivers/dma/idxd/compat.c
     33  static ssize_t bind_store(struct device_driver *drv, const char *buf, size_t count)
     34  {
     35          struct bus_type *bus = drv->bus;
     36          struct device *dev;
     37          struct device_driver *alt_drv;
     38          int rc = -ENODEV;
     39          struct idxd_dev *idxd_dev;
     40
     41          dev = bus_find_device_by_name(bus, NULL, buf);
     42          if (!dev || dev->driver || drv != &dsa_drv.drv)
     43                  return -ENODEV;
     44
     45          idxd_dev = confdev_to_idxd_dev(dev);
     46          if (is_idxd_dev(idxd_dev)) {
     47                  alt_drv = driver_find("idxd", bus);
     48                  if (!alt_drv)
     49                          return -ENODEV;
     50          } else if (is_idxd_wq_dev(idxd_dev)) {
                            ^^^^^^^^^^^^^^^^^^^^^^^^
Presumably this condition is always true but the static checker is not
smart enough to figure it out.

     51                  struct idxd_wq *wq = confdev_to_wq(dev);
     52
     53                  if (is_idxd_wq_kernel(wq)) {
     54                          alt_drv = driver_find("dmaengine", bus);
     55                          if (!alt_drv)
     56                                  return -ENODEV;
     57                  } else if (is_idxd_wq_user(wq)) {
     58                          alt_drv = driver_find("user", bus);
     59                          if (!alt_drv)
     60                                  return -ENODEV;
     61                  } else {
     62                          return -ENODEV;
     63                  }
     64          }
     65
     66          rc = device_driver_attach(alt_drv, dev);
     67          if (rc < 0)
     68                  return rc;
     69
     70          return count;
     71  }

regards,
dan carpenter



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux PCI]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux