All of lore.kernel.org
 help / color / mirror / Atom feed
From: zengjx95@gmail.com
To: reiserfs-devel@vger.kernel.org
Cc: willy@infradead.org, jlayton@kernel.org,
	damien.lemoal@opensource.wdc.com, jack@suse.cz,
	edward.shishkin@gmail.com, linux-kernel@vger.kernel.org,
	Zeng Jingxiang <linuszeng@tencent.com>
Subject: [PATCH] fs/reiserfs/inode: remove dead code in _get_block_create_0()
Date: Wed, 20 Jul 2022 14:33:10 +0800	[thread overview]
Message-ID: <20220720063310.992149-1-zengjx95@gmail.com> (raw)

From: Zeng Jingxiang <linuszeng@tencent.com>

Fix "control flow" issues found by Coverity
Logically dead code (DEADCODE)
Execution cannot reach this statement.

Assigned_value: Assigning value NULL to p here
293	char *p = NULL;
In the following conditional expression, the value of p is always NULL,
as a result, the kunmap() cannot be executed.
308	if (p)
309		kunmap(bh_result->b_page);

355	if (p)
356		kunmap(bh_result->b_page);

366	if (p)
367		kunmap(bh_result->b_page);

Signed-off-by: Zeng Jingxiang <linuszeng@tencent.com>
---
 fs/reiserfs/inode.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 0cffe054b78e..d1b0c7645fcb 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -305,8 +305,6 @@ static int _get_block_create_0(struct inode *inode, sector_t block,
 	result = search_for_position_by_key(inode->i_sb, &key, &path);
 	if (result != POSITION_FOUND) {
 		pathrelse(&path);
-		if (p)
-			kunmap(bh_result->b_page);
 		if (result == IO_ERROR)
 			return -EIO;
 		/*
@@ -352,8 +350,6 @@ static int _get_block_create_0(struct inode *inode, sector_t block,
 		}
 
 		pathrelse(&path);
-		if (p)
-			kunmap(bh_result->b_page);
 		return ret;
 	}
 	/* requested data are in direct item(s) */
@@ -363,8 +359,6 @@ static int _get_block_create_0(struct inode *inode, sector_t block,
 		 * when it is stored in direct item(s)
 		 */
 		pathrelse(&path);
-		if (p)
-			kunmap(bh_result->b_page);
 		return -ENOENT;
 	}
 
-- 
2.27.0


             reply	other threads:[~2022-07-20  6:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20  6:33 zengjx95 [this message]
2022-07-20  6:57 ` [PATCH] fs/reiserfs/inode: remove dead code in _get_block_create_0() Al Viro
  -- strict thread matches above, loose matches on Subject: below --
2022-07-20  8:30 zengjx95
2022-07-26 10:48 ` Jan Kara

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=20220720063310.992149-1-zengjx95@gmail.com \
    --to=zengjx95@gmail.com \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=edward.shishkin@gmail.com \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=linuszeng@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.