linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	kbuild test robot <lkp@intel.com>
Subject: Re: [PATCH] dax: use correct dev_t value
Date: Thu, 8 Sep 2016 07:56:31 -0700	[thread overview]
Message-ID: <CAPcyv4gfW4MdZJmueAY34D4+NzzHDrJyj1Hzg8v8fzyYphpFLw@mail.gmail.com> (raw)
In-Reply-To: <20160908135431.1310985-1-arnd@arndb.de>

[ adding 0day robot ]

On Thu, Sep 8, 2016 at 6:53 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> The dev_t variable in devm_create_dax_dev() is used before it's
> first set:
>
> drivers/dax/dax.c: In function 'devm_create_dax_dev':
> drivers/dax/dax.c:205:39: error: 'dev_t' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>   inode = iget5_locked(dax_superblock, hash_32(devt + DAXFS_MAGIC, 31),
>                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/dax/dax.c:688:8: note: 'dev_t' was declared here
>
> This reorders the code to how it looks correct to me.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 3bc52c45bac2 ("dax: define a unified inode/address_space for device-dax mappings")
> ---
>  drivers/dax/dax.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c
> index 68bb5e35b639..98dbbc12055f 100644
> --- a/drivers/dax/dax.c
> +++ b/drivers/dax/dax.c
> @@ -731,6 +731,8 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region,
>                 goto err_minor;
>         }
>
> +       dev_t = MKDEV(MAJOR(dax_devt), minor);
> +       dev = &dax_dev->dev;
>         dax_dev->inode = dax_inode_get(&dax_dev->cdev, dev_t);
>         if (!dax_dev->inode) {
>                 rc = -ENOMEM;
> @@ -738,8 +740,6 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region,
>         }
>
>         /* device_initialize() so cdev can reference kobj parent */
> -       dev_t = MKDEV(MAJOR(dax_devt), minor);
> -       dev = &dax_dev->dev;
>         device_initialize(dev);
>
>         cdev = &dax_dev->cdev;

Looks good to me.

Strange, I don't see this error with gcc-5.3.1, I assume 0day missed
it for a similar reason?

  reply	other threads:[~2016-09-08 14:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 13:53 [PATCH] dax: use correct dev_t value Arnd Bergmann
2016-09-08 14:56 ` Dan Williams [this message]
2016-09-08 15:03   ` Arnd Bergmann

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=CAPcyv4gfW4MdZJmueAY34D4+NzzHDrJyj1Hzg8v8fzyYphpFLw@mail.gmail.com \
    --to=dan.j.williams@intel.com \
    --cc=arnd@arndb.de \
    --cc=jthumshirn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    /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).