Skip to content

Commit

Permalink
FS-Cache: Avoid maybe-used-uninitialised warning on variable
Browse files Browse the repository at this point in the history
Andrew Morton's compiler sees the following warning in FS-Cache:

fs/fscache/object-list.c: In function 'fscache_objlist_lookup':
fs/fscache/object-list.c:94: warning: 'obj' may be used uninitialized in this function

which my compiler doesn't.  This is a false positive as obj can only be
used in the comparison against minobj if minobj has been set to something
other than NULL, but for that to happen, obj has to be first set to
something.

Deal with this by preclearing obj too.

Reported-by: Andrew Morton <[email protected]>
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
dhowells authored and torvalds committed Dec 16, 2009
1 parent 06a7f71 commit ea58ceb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/fscache/object-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ EXPORT_SYMBOL(fscache_object_destroy);
*/
static struct fscache_object *fscache_objlist_lookup(loff_t *_pos)
{
struct fscache_object *pobj, *obj, *minobj = NULL;
struct fscache_object *pobj, *obj = NULL, *minobj = NULL;
struct rb_node *p;
unsigned long pos;

Expand Down

0 comments on commit ea58ceb

Please sign in to comment.