File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1299,12 +1299,16 @@ static void zram_meta_free(struct zram *zram, u64 disksize)
1299
1299
size_t num_pages = disksize >> PAGE_SHIFT ;
1300
1300
size_t index ;
1301
1301
1302
+ if (!zram -> table )
1303
+ return ;
1304
+
1302
1305
/* Free all pages that are still in this zram device */
1303
1306
for (index = 0 ; index < num_pages ; index ++ )
1304
1307
zram_free_page (zram , index );
1305
1308
1306
1309
zs_destroy_pool (zram -> mem_pool );
1307
1310
vfree (zram -> table );
1311
+ zram -> table = NULL ;
1308
1312
}
1309
1313
1310
1314
static bool zram_meta_alloc (struct zram * zram , u64 disksize )
@@ -1319,6 +1323,7 @@ static bool zram_meta_alloc(struct zram *zram, u64 disksize)
1319
1323
zram -> mem_pool = zs_create_pool (zram -> disk -> disk_name );
1320
1324
if (!zram -> mem_pool ) {
1321
1325
vfree (zram -> table );
1326
+ zram -> table = NULL ;
1322
1327
return false;
1323
1328
}
1324
1329
@@ -2131,11 +2136,6 @@ static void zram_reset_device(struct zram *zram)
2131
2136
2132
2137
zram -> limit_pages = 0 ;
2133
2138
2134
- if (!init_done (zram )) {
2135
- up_write (& zram -> init_lock );
2136
- return ;
2137
- }
2138
-
2139
2139
set_capacity_and_notify (zram -> disk , 0 );
2140
2140
part_stat_set_all (zram -> disk -> part0 , 0 );
2141
2141
You can’t perform that action at this time.
0 commit comments