Skip to content

Commit 16be797

Browse files
mcgrofaxboe
authored andcommitted
nvdimm/btt: add error handling support for add_disk()
We never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling. Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 2762ff0 commit 16be797

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/nvdimm/btt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,9 @@ static int btt_blk_init(struct btt *btt)
15411541
}
15421542

15431543
set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9);
1544-
device_add_disk(&btt->nd_btt->dev, btt->btt_disk, NULL);
1544+
rc = device_add_disk(&btt->nd_btt->dev, btt->btt_disk, NULL);
1545+
if (rc)
1546+
goto out_cleanup_disk;
15451547

15461548
btt->nd_btt->size = btt->nlba * (u64)btt->sector_size;
15471549
nvdimm_check_and_set_ro(btt->btt_disk);

0 commit comments

Comments
 (0)