Commit 514cf4f8 authored by Peng Wang's avatar Peng Wang Committed by Mike Snitzer

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: default avatarPeng Wang <rocking@whu.edu.cn>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 5de719e3
......@@ -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));
......
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