dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: dave.jiang@intel.com
Cc: dmaengine@vger.kernel.org
Subject: [bug report] dmaengine: idxd: move dsa_drv support to compatible mode
Date: Fri, 23 Jul 2021 16:35:08 +0300	[thread overview]
Message-ID: <20210723133508.GA18022@kili> (raw)

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'.

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

             reply	other threads:[~2021-07-23 13:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 13:35 Dan Carpenter [this message]
2021-07-23 15:06 ` [bug report] dmaengine: idxd: move dsa_drv support to compatible mode Dave Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210723133508.GA18022@kili \
    --to=dan.carpenter@oracle.com \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).