The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] fs/btrfs/ordered-data.c: fixed compiler warnings for using uninitialized variable
@ 2010-09-10 14:42 Frank Morales II
  2010-09-12 10:36 ` Felipe Contreras
  0 siblings, 1 reply; 2+ messages in thread
From: Frank Morales II @ 2010-09-10 14:42 UTC (permalink / raw)
  To: chris.mason, josef, zheng.yan, jens.axboe, tj; +Cc: linux-btrfs, linux-kernel

>From 1c304defc543738f82ccb18fe10b558dd2098d74 Mon Sep 17 00:00:00 2001
From: Frank Morales II <altf2o@gmail.com>
Date: Fri, 10 Sep 2010 07:34:23 -0700
Subject: [PATCH] fs/btrfs/ordered-data.c: fixed compiler warnings for using uninitialized variable

In the function tree_search, the variable prev was used without first
being initialized, causing compiler warning messages. Initializing
prev to NULL resolved the issue.

Kernal patched against: 2.6.36-rc3 (df423dc7)

Signed-off-by: Frank Morales II <altf2o@gmail.com>
---
 fs/btrfs/ordered-data.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index e56c72b..fad2616 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -141,7 +141,7 @@ static inline struct rb_node *tree_search(struct btrfs_ordered_inode_tree *tree,
 					  u64 file_offset)
 {
 	struct rb_root *root = &tree->tree;
-	struct rb_node *prev;
+	struct rb_node *prev = NULL;
 	struct rb_node *ret;
 	struct btrfs_ordered_extent *entry;
 
-- 
1.7.0.4




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs/btrfs/ordered-data.c: fixed compiler warnings for using uninitialized variable
  2010-09-10 14:42 [PATCH] fs/btrfs/ordered-data.c: fixed compiler warnings for using uninitialized variable Frank Morales II
@ 2010-09-12 10:36 ` Felipe Contreras
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Contreras @ 2010-09-12 10:36 UTC (permalink / raw)
  To: Frank Morales II
  Cc: chris.mason, josef, zheng.yan, jens.axboe, tj, linux-btrfs,
	linux-kernel

On Fri, Sep 10, 2010 at 5:42 PM, Frank Morales II <altf2o@gmail.com> wrote:
> >From 1c304defc543738f82ccb18fe10b558dd2098d74 Mon Sep 17 00:00:00 2001
> From: Frank Morales II <altf2o@gmail.com>
> Date: Fri, 10 Sep 2010 07:34:23 -0700
> Subject: [PATCH] fs/btrfs/ordered-data.c: fixed compiler warnings for using uninitialized variable
>
> In the function tree_search, the variable prev was used without first
> being initialized, causing compiler warning messages. Initializing
> prev to NULL resolved the issue.
>
> Kernal patched against: 2.6.36-rc3 (df423dc7)

Signed-of-by: Felipe Contreras <felipe.contreras@gmail.com>

I came up with exactly this patch, but this is my commit message:

    Btrfs: fix compilation warning

    fs/btrfs/ordered-data.c: In function ‘tree_search’:
    fs/btrfs/ordered-data.c:144: warning: ‘prev’ may be used
uninitialized in this function
    fs/btrfs/ordered-data.c: In function ‘btrfs_lookup_first_ordered_extent’:
    fs/btrfs/ordered-data.c:144: warning: ‘prev’ may be used
uninitialized in this function
    fs/btrfs/ordered-data.c:144: note: ‘prev’ was declared here
    fs/btrfs/ordered-data.c: In function ‘btrfs_lookup_ordered_extent’:
    fs/btrfs/ordered-data.c:144: warning: ‘prev’ may be used
uninitialized in this function
    fs/btrfs/ordered-data.c:144: note: ‘prev’ was declared here
    fs/btrfs/ordered-data.c: In function ‘btrfs_lookup_ordered_range’:
    fs/btrfs/ordered-data.c:144: warning: ‘prev’ may be used
uninitialized in this function
    fs/btrfs/ordered-data.c:144: note: ‘prev’ was declared here
    fs/btrfs/ordered-data.c: In function ‘btrfs_dec_test_ordered_pending’:
    fs/btrfs/ordered-data.c:144: warning: ‘prev’ may be used
uninitialized in this function
    fs/btrfs/ordered-data.c:144: note: ‘prev’ was declared here

    __tree_search() might not set &prev.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-12 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-10 14:42 [PATCH] fs/btrfs/ordered-data.c: fixed compiler warnings for using uninitialized variable Frank Morales II
2010-09-12 10:36 ` Felipe Contreras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox