Skip to content

Commit

Permalink
fs/buffer: Remove redundant assignment to err
Browse files Browse the repository at this point in the history
Variable 'err' set but not used.

fs/buffer.c:2613:2: warning: Value stored to 'err' is never read.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4589
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
  • Loading branch information
Jiapeng Chong authored and Christian Brauner committed Mar 27, 2023
1 parent 4e04143 commit dc7cb2d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2581,7 +2581,7 @@ int block_truncate_page(struct address_space *mapping,
struct inode *inode = mapping->host;
struct page *page;
struct buffer_head *bh;
int err;
int err = 0;

blocksize = i_blocksize(inode);
length = offset & (blocksize - 1);
Expand All @@ -2594,9 +2594,8 @@ int block_truncate_page(struct address_space *mapping,
iblock = (sector_t)index << (PAGE_SHIFT - inode->i_blkbits);

page = grab_cache_page(mapping, index);
err = -ENOMEM;
if (!page)
goto out;
return -ENOMEM;

if (!page_has_buffers(page))
create_empty_buffers(page, blocksize, 0);
Expand All @@ -2610,7 +2609,6 @@ int block_truncate_page(struct address_space *mapping,
pos += blocksize;
}

err = 0;
if (!buffer_mapped(bh)) {
WARN_ON(bh->b_size != blocksize);
err = get_block(inode, iblock, bh, 0);
Expand All @@ -2634,12 +2632,11 @@ int block_truncate_page(struct address_space *mapping,

zero_user(page, offset, length);
mark_buffer_dirty(bh);
err = 0;

unlock:
unlock_page(page);
put_page(page);
out:

return err;
}
EXPORT_SYMBOL(block_truncate_page);
Expand Down

0 comments on commit dc7cb2d

Please sign in to comment.