yaffs: Fix NULL check sequence.
authorCharles Manning <cdhmanning@gmail.com>
Wed, 19 Jan 2011 22:35:08 +0000 (11:35 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Wed, 19 Jan 2011 22:35:08 +0000 (11:35 +1300)
Potential NULL dreference before check.
Picked up by Coverity check.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
yaffs_guts.c

index a579eee..496cf5f 100644 (file)
@@ -1640,15 +1640,15 @@ static void yaffs_unhash_obj(struct yaffs_obj *obj)
 /*  FreeObject frees up a Object and puts it back on the free list */
 static void yaffs_free_obj(struct yaffs_obj *obj)
 {
-       struct yaffs_dev *dev = obj->my_dev;
-
-       yaffs_trace(YAFFS_TRACE_OS, "FreeObject %p inode %p",
-               obj, obj->my_inode);
+       struct yaffs_dev *dev;
 
        if (!obj) {
                YBUG();
                return;
        }
+       dev = obj->my_dev;
+       yaffs_trace(YAFFS_TRACE_OS, "FreeObject %p inode %p",
+               obj, obj->my_inode);
        if (obj->parent)
                YBUG();
        if (!list_empty(&obj->siblings))