Commit 4c467647 authored by Zhang Qilong's avatar Zhang Qilong Committed by Dan Williams

libnvdimm/label: Return -ENXIO for no slot in __blk_label_update

Forget to set error code when nd_label_alloc_slot failed, and we
add it to avoid overwritten error code.

Fixes: 0ba1c634 ("libnvdimm: write blk label set")
Signed-off-by: default avatarZhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201205115056.2076523-1-zhangqilong3@huawei.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 5ae96d77
...@@ -1008,8 +1008,10 @@ static int __blk_label_update(struct nd_region *nd_region, ...@@ -1008,8 +1008,10 @@ static int __blk_label_update(struct nd_region *nd_region,
if (is_old_resource(res, old_res_list, old_num_resources)) if (is_old_resource(res, old_res_list, old_num_resources))
continue; /* carry-over */ continue; /* carry-over */
slot = nd_label_alloc_slot(ndd); slot = nd_label_alloc_slot(ndd);
if (slot == UINT_MAX) if (slot == UINT_MAX) {
rc = -ENXIO;
goto abort; goto abort;
}
dev_dbg(ndd->dev, "allocated: %d\n", slot); dev_dbg(ndd->dev, "allocated: %d\n", slot);
nd_label = to_label(ndd, slot); nd_label = to_label(ndd, slot);
......
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