]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/fib_hash.c
[ALSA] at73c213: monaural support
[linux-2.6-omap-h63xx.git] / net / ipv4 / fib_hash.c
index 76b9c684cccd2ac6d159ea597c0e734ed26f4b05..02088deb046193262b81342bcca1cd5f2bf88506 100644 (file)
@@ -372,7 +372,8 @@ static struct fib_node *fib_find_node(struct fn_zone *fz, __be32 key)
 static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
 {
        struct fn_hash *table = (struct fn_hash *) tb->tb_data;
-       struct fib_node *new_f, *f;
+       struct fib_node *new_f = NULL;
+       struct fib_node *f;
        struct fib_alias *fa, *new_fa;
        struct fn_zone *fz;
        struct fib_info *fi;
@@ -496,7 +497,6 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
 
        err = -ENOBUFS;
 
-       new_f = NULL;
        if (!f) {
                new_f = kmem_cache_zalloc(fn_hash_kmem, GFP_KERNEL);
                if (new_f == NULL)
@@ -512,7 +512,7 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
        if (new_fa->fa_info != NULL) {
                new_fa = kmem_cache_alloc(fn_alias_kmem, GFP_KERNEL);
                if (new_fa == NULL)
-                       goto out_free_new_f;
+                       goto out;
        }
        new_fa->fa_info = fi;
        new_fa->fa_tos = tos;
@@ -540,9 +540,9 @@ static int fn_hash_insert(struct fib_table *tb, struct fib_config *cfg)
                  &cfg->fc_nlinfo, 0);
        return 0;
 
-out_free_new_f:
-       kmem_cache_free(fn_hash_kmem, new_f);
 out:
+       if (new_f)
+               kmem_cache_free(fn_hash_kmem, new_f);
        fib_release_info(fi);
        return err;
 }
@@ -821,7 +821,7 @@ static struct fib_alias *fib_get_first(struct seq_file *seq)
        struct fib_table *main_table;
        struct fn_hash *table;
 
-       main_table = fib_get_table(iter->p.net, RT_TABLE_MAIN);
+       main_table = fib_get_table(seq_file_net(seq), RT_TABLE_MAIN);
        table = (struct fn_hash *)main_table->tb_data;
 
        iter->bucket    = 0;
@@ -959,11 +959,10 @@ static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos)
 static void *fib_seq_start(struct seq_file *seq, loff_t *pos)
        __acquires(fib_hash_lock)
 {
-       struct fib_iter_state *iter = seq->private;
        void *v = NULL;
 
        read_lock(&fib_hash_lock);
-       if (fib_get_table(iter->p.net, RT_TABLE_MAIN))
+       if (fib_get_table(seq_file_net(seq), RT_TABLE_MAIN))
                v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
        return v;
 }