dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: dmaengine@vger.kernel.org
Subject: Re: [bug report] dmaengine: idxd: move dsa_drv support to compatible mode
Date: Fri, 23 Jul 2021 08:06:44 -0700	[thread overview]
Message-ID: <60a20b28-bf03-9bc9-e80d-301ec7c5b4e8@intel.com> (raw)
In-Reply-To: <20210723133508.GA18022@kili>


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@djiang5-desk3.ch.intel.com/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

      reply	other threads:[~2021-07-23 15:06 UTC|newest]

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

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=60a20b28-bf03-9bc9-e80d-301ec7c5b4e8@intel.com \
    --to=dave.jiang@intel.com \
    --cc=dan.carpenter@oracle.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).