mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Johannes Thumshirn <jthumshirn@suse.de>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] dax: use correct dev_t value
Date: Thu,  8 Sep 2016 15:53:28 +0200	[thread overview]
Message-ID: <20160908135431.1310985-1-arnd@arndb.de> (raw)

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;
-- 
2.9.0

             reply	other threads:[~2016-09-08 13:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 13:53 Arnd Bergmann [this message]
2016-09-08 14:56 ` Dan Williams
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=20160908135431.1310985-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=dan.j.williams@intel.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®