mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhen Lei <thunder.leizhen@huawei.com>
To: Jens Axboe <axboe@kernel.dk>,
	linux-block <linux-block@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Subject: [PATCH 1/1] brd: remove a redundant check
Date: Wed, 22 Apr 2020 09:28:11 +0800	[thread overview]
Message-ID: <20200422012811.1606-1-thunder.leizhen@huawei.com> (raw)

Because pages[i] can't be NULL, otherwise "pos = pages[i]->index;" will
panic. So when "ret" is NULL, it can't be equal to pages[i].

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/block/brd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 2fb25c348d53..59fec4a8ac93 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -147,7 +147,7 @@ static void brd_free_pages(struct brd_device *brd)
 			BUG_ON(pages[i]->index < pos);
 			pos = pages[i]->index;
 			ret = radix_tree_delete(&brd->brd_pages, pos);
-			BUG_ON(!ret || ret != pages[i]);
+			BUG_ON(ret != pages[i]);
 			__free_page(pages[i]);
 		}
 
-- 
2.26.0.106.g9fadedd



             reply	other threads:[~2020-04-22  1:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22  1:28 Zhen Lei [this message]
2020-04-24  2:08 ` Leizhen (ThunderTown)

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=20200422012811.1606-1-thunder.leizhen@huawei.com \
    --to=thunder.leizhen@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®