mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yue Hu <zbestahu@gmail.com>
To: minchan@kernel.org, ngupta@vflare.org,
	sergey.senozhatsky.work@gmail.com, axboe@kernel.dk
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	huyue2@yulong.com, zbestahu@163.com
Subject: [PATCH] drivers/block/zram/zram_drv.c: remove WARN_ON_ONCE() in free_block_bdev()
Date: Wed, 26 Feb 2020 16:32:17 +0800	[thread overview]
Message-ID: <20200226083217.5720-1-zbestahu@gmail.com> (raw)

From: Yue Hu <huyue2@yulong.com>

Currently, free_block_bdev() only happens after calling 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@yulong.com>
---
 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


                 reply	other threads:[~2020-02-26  8:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200226083217.5720-1-zbestahu@gmail.com \
    --to=zbestahu@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=huyue2@yulong.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=zbestahu@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®