diff mbox series

[2/8] btrfs: fix uninit warning in btrfs_cleanup_ordered_extents

Message ID 8224d05027554e265bb92bd4a7862950e6c7d224.1671221596.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series Fixup uninitialized warnings and enable extra checks | expand

Commit Message

Josef Bacik Dec. 16, 2022, 8:15 p.m. UTC
We can conditionally pass in a locked page, and then we'll use that page
range to skip marking errors as that will happen in another layer.
However this causes the compiler to complain because it doesn't
understand we only use these values when we have the page.  Make the
compiler stop complaining by setting these values to 0.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Qu Wenruo Dec. 17, 2022, 12:16 a.m. UTC | #1
On 2022/12/17 04:15, Josef Bacik wrote:
> We can conditionally pass in a locked page, and then we'll use that page
> range to skip marking errors as that will happen in another layer.
> However this causes the compiler to complain because it doesn't
> understand we only use these values when we have the page.  Make the
> compiler stop complaining by setting these values to 0.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   fs/btrfs/inode.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 905ea19df125..dfceaf79d5d4 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -228,7 +228,7 @@ static inline void btrfs_cleanup_ordered_extents(struct btrfs_inode *inode,
>   {
>   	unsigned long index = offset >> PAGE_SHIFT;
>   	unsigned long end_index = (offset + bytes - 1) >> PAGE_SHIFT;
> -	u64 page_start, page_end;
> +	u64 page_start = 0, page_end = 0;
>   	struct page *page;
>   
>   	if (locked_page) {
Johannes Thumshirn Dec. 19, 2022, 7:53 a.m. UTC | #2
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 905ea19df125..dfceaf79d5d4 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -228,7 +228,7 @@  static inline void btrfs_cleanup_ordered_extents(struct btrfs_inode *inode,
 {
 	unsigned long index = offset >> PAGE_SHIFT;
 	unsigned long end_index = (offset + bytes - 1) >> PAGE_SHIFT;
-	u64 page_start, page_end;
+	u64 page_start = 0, page_end = 0;
 	struct page *page;
 
 	if (locked_page) {