summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorPeng Wang <rocking@whu.edu.cn>2019-04-18 21:59:19 +0800
committerMike Snitzer <snitzer@redhat.com>2019-04-26 11:28:17 -0400
commit514cf4f881dc82507d87d2ccd5e7478fd36632fa (patch)
tree4b6d56aa2931004b96a9878bb3a154ee2d3be376 /drivers/md
parent5de719e3d01b4abe0de0d7b857148a880ff2a90b (diff)
downloadlwn-514cf4f881dc82507d87d2ccd5e7478fd36632fa.tar.gz
lwn-514cf4f881dc82507d87d2ccd5e7478fd36632fa.zip
dm: only initialize md->dax_dev if CONFIG_DAX_DRIVER is enabled
md->dax_dev defaults to NULL and there is no need to initialize it if CONFIG_DAX_DRIVER is disabled. Signed-off-by: Peng Wang <rocking@whu.edu.cn> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 043f0761e4a0..56c34a0a9cd9 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1906,7 +1906,6 @@ static void cleanup_mapped_device(struct mapped_device *md)
static struct mapped_device *alloc_dev(int minor)
{
int r, numa_node_id = dm_get_numa_node();
- struct dax_device *dax_dev = NULL;
struct mapped_device *md;
void *old_md;
@@ -1969,11 +1968,10 @@ static struct mapped_device *alloc_dev(int minor)
sprintf(md->disk->disk_name, "dm-%d", minor);
if (IS_ENABLED(CONFIG_DAX_DRIVER)) {
- dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops);
- if (!dax_dev)
+ md->dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops);
+ if (!md->dax_dev)
goto bad;
}
- md->dax_dev = dax_dev;
add_disk_no_queue_reg(md->disk);
format_dev_t(md->name, MKDEV(_major, minor));