File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1519,6 +1519,7 @@ static int btt_blk_init(struct btt *btt)
1519
1519
{
1520
1520
struct nd_btt * nd_btt = btt -> nd_btt ;
1521
1521
struct nd_namespace_common * ndns = nd_btt -> ndns ;
1522
+ int rc = - ENOMEM ;
1522
1523
1523
1524
btt -> btt_disk = blk_alloc_disk (NUMA_NO_NODE );
1524
1525
if (!btt -> btt_disk )
@@ -1534,19 +1535,22 @@ static int btt_blk_init(struct btt *btt)
1534
1535
blk_queue_flag_set (QUEUE_FLAG_NONROT , btt -> btt_disk -> queue );
1535
1536
1536
1537
if (btt_meta_size (btt )) {
1537
- int rc = nd_integrity_init (btt -> btt_disk , btt_meta_size (btt ));
1538
-
1539
- if (rc ) {
1540
- blk_cleanup_disk (btt -> btt_disk );
1541
- return rc ;
1542
- }
1538
+ rc = nd_integrity_init (btt -> btt_disk , btt_meta_size (btt ));
1539
+ if (rc )
1540
+ goto out_cleanup_disk ;
1543
1541
}
1542
+
1544
1543
set_capacity (btt -> btt_disk , btt -> nlba * btt -> sector_size >> 9 );
1545
1544
device_add_disk (& btt -> nd_btt -> dev , btt -> btt_disk , NULL );
1545
+
1546
1546
btt -> nd_btt -> size = btt -> nlba * (u64 )btt -> sector_size ;
1547
1547
nvdimm_check_and_set_ro (btt -> btt_disk );
1548
1548
1549
1549
return 0 ;
1550
+
1551
+ out_cleanup_disk :
1552
+ blk_cleanup_disk (btt -> btt_disk );
1553
+ return rc ;
1550
1554
}
1551
1555
1552
1556
static void btt_blk_cleanup (struct btt * btt )
You can’t perform that action at this time.
0 commit comments