fs/reiserfs/inode: remove dead code in _get_block_create_0()

Since commit 27b3a5c51b ("kill-the-bkl/reiserfs: drop the fs race
watchdog from _get_block_create_0()"), which removed a label that may
have the pointer 'p' touched in its control flow, related if statements
now eval to constant value now. Just remove them.

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);

Also, the kmap() cannot be executed.
399	if (!p)
400		p = (char *)kmap(bh_result->b_page);

[JK: Removed unnecessary initialization of 'p' to NULL]

Signed-off-by: Zeng Jingxiang <linuszeng@tencent.com>
Signed-off-by: Kairui Song <kasong@tencent.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220720083029.1065578-1-zengjx95@gmail.com
This commit is contained in:
Zeng Jingxiang 2022-07-20 16:30:29 +08:00 committed by Jan Kara
parent 9888725d8a
commit bd6e21a904

View File

@ -290,7 +290,7 @@ static int _get_block_create_0(struct inode *inode, sector_t block,
struct buffer_head *bh; struct buffer_head *bh;
struct item_head *ih, tmp_ih; struct item_head *ih, tmp_ih;
b_blocknr_t blocknr; b_blocknr_t blocknr;
char *p = NULL; char *p;
int chars; int chars;
int ret; int ret;
int result; int result;
@ -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); result = search_for_position_by_key(inode->i_sb, &key, &path);
if (result != POSITION_FOUND) { if (result != POSITION_FOUND) {
pathrelse(&path); pathrelse(&path);
if (p)
kunmap(bh_result->b_page);
if (result == IO_ERROR) if (result == IO_ERROR)
return -EIO; return -EIO;
/* /*
@ -352,8 +350,6 @@ static int _get_block_create_0(struct inode *inode, sector_t block,
} }
pathrelse(&path); pathrelse(&path);
if (p)
kunmap(bh_result->b_page);
return ret; return ret;
} }
/* requested data are in direct item(s) */ /* 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) * when it is stored in direct item(s)
*/ */
pathrelse(&path); pathrelse(&path);
if (p)
kunmap(bh_result->b_page);
return -ENOENT; return -ENOENT;
} }
@ -396,9 +390,7 @@ static int _get_block_create_0(struct inode *inode, sector_t block,
* sure we need to. But, this means the item might move if * sure we need to. But, this means the item might move if
* kmap schedules * kmap schedules
*/ */
if (!p) p = (char *)kmap(bh_result->b_page);
p = (char *)kmap(bh_result->b_page);
p += offset; p += offset;
memset(p, 0, inode->i_sb->s_blocksize); memset(p, 0, inode->i_sb->s_blocksize);
do { do {