kernel: Move some dereferences below the NULL checks.
authorSascha Wildner <saw@online.de>
Sun, 4 Dec 2011 19:15:43 +0000 (20:15 +0100)
committerSascha Wildner <saw@online.de>
Sun, 4 Dec 2011 19:15:43 +0000 (20:15 +0100)
sys/dev/drm/mach64_state.c
sys/gnu/vfs/ext2fs/ext2_linux_balloc.c

index ec96709..186d55e 100644 (file)
@@ -823,7 +823,7 @@ int mach64_dma_vertex(struct drm_device *dev, void *data,
                      struct drm_file *file_priv)
 {
        drm_mach64_private_t *dev_priv = dev->dev_private;
-       drm_mach64_sarea_t *sarea_priv = dev_priv->sarea_priv;
+       drm_mach64_sarea_t *sarea_priv;
        drm_mach64_vertex_t *vertex = data;
 
        LOCK_TEST_WITH_RETURN(dev, file_priv);
@@ -833,6 +833,8 @@ int mach64_dma_vertex(struct drm_device *dev, void *data,
                return -EINVAL;
        }
 
+       sarea_priv = dev_priv->sarea_priv;
+
        DRM_DEBUG("pid=%d buf=%p used=%lu discard=%d\n",
                  DRM_CURRENTPID,
                  vertex->buf, vertex->used, vertex->discard);
index 480565d..586b601 100644 (file)
@@ -182,12 +182,13 @@ ext2_free_blocks(struct mount * mp, unsigned long block,
        unsigned long i;
        int bitmap_nr;
        struct ext2_group_desc * gdp;
-       struct ext2_super_block * es = sb->s_es;
+       struct ext2_super_block * es;
 
        if (!sb) {
                kprintf ("ext2_free_blocks: nonexistent device");
                return;
        }
+       es = sb->s_es;
        lock_super (VFSTOEXT2(mp)->um_devvp);
        if (block < es->s_first_data_block ||
            (block + count) > es->s_blocks_count) {
@@ -267,7 +268,7 @@ ext2_new_block(struct mount * mp, unsigned long goal,
        int i, j, k, tmp;
        int bitmap_nr;
        struct ext2_group_desc * gdp;
-       struct ext2_super_block * es = sb->s_es;
+       struct ext2_super_block * es;
 
 #ifdef EXT2FS_DEBUG
        static int goal_hits = 0, goal_attempts = 0;
@@ -276,6 +277,7 @@ ext2_new_block(struct mount * mp, unsigned long goal,
                kprintf ("ext2_new_block: nonexistent device");
                return 0;
        }
+       es = sb->s_es;
        lock_super (VFSTOEXT2(mp)->um_devvp);
 
         ext2_debug ("goal=%lu.\n", goal);