From: Yue Hu <huyue2@xxxxxxxxxx> Currently, free_block_bdev() only happens after alloc_block_bdev() which will ensure blk_idx bit to be set using test_and_set_bit(). So no need to do WARN_ON_ONCE(!was_set) again when freeing. Signed-off-by: Yue Hu <huyue2@xxxxxxxxxx> --- drivers/block/zram/zram_drv.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 1bdb579..61b10ab 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -570,10 +570,7 @@ static unsigned long alloc_block_bdev(struct zram *zram) static void free_block_bdev(struct zram *zram, unsigned long blk_idx) { - int was_set; - - was_set = test_and_clear_bit(blk_idx, zram->bitmap); - WARN_ON_ONCE(!was_set); + clear_bit(blk_idx, zram->bitmap); atomic64_dec(&zram->stats.bd_count); } -- 1.9.1