Commit bc0a0fe9 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Dan Williams

dax: use correct dev_t value

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: default avatarArnd Bergmann <arnd@arndb.de>
Fixes: 3bc52c45 ("dax: define a unified inode/address_space for device-dax mappings")
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent d76911ee
...@@ -598,6 +598,8 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region, ...@@ -598,6 +598,8 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region,
goto err_minor; 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); dax_dev->inode = dax_inode_get(&dax_dev->cdev, dev_t);
if (!dax_dev->inode) { if (!dax_dev->inode) {
rc = -ENOMEM; rc = -ENOMEM;
...@@ -605,8 +607,6 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region, ...@@ -605,8 +607,6 @@ struct dax_dev *devm_create_dax_dev(struct dax_region *dax_region,
} }
/* device_initialize() so cdev can reference kobj parent */ /* device_initialize() so cdev can reference kobj parent */
dev_t = MKDEV(MAJOR(dax_devt), minor);
dev = &dax_dev->dev;
device_initialize(dev); device_initialize(dev);
cdev = &dax_dev->cdev; cdev = &dax_dev->cdev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment