flex_array: remove unneeded index calculation
authorJonathan Corbet <corbet@lwn.net>
Tue, 4 Aug 2009 19:35:17 +0000 (13:35 -0600)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 4 Aug 2009 22:33:46 +0000 (15:33 -0700)
flex_array_get() calculates an index value, then drops it on the floor;
simply remove it.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Acked-by: Dave Hansen <dave@linux.vnet.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
lib/flex_array.c

index 0e7894ce88823474e9ca25c0f73bd8445ed1ea30..08f1636d296ae2fa1032e0fd06d1ccd15ff1a4c3 100644 (file)
@@ -254,7 +254,6 @@ void *flex_array_get(struct flex_array *fa, int element_nr)
 {
        int part_nr = fa_element_to_part_nr(fa, element_nr);
        struct flex_array_part *part;
-       int index;
 
        if (element_nr >= fa->total_nr_elements)
                return NULL;
@@ -264,6 +263,5 @@ void *flex_array_get(struct flex_array *fa, int element_nr)
                part = (struct flex_array_part *)&fa->parts[0];
        else
                part = fa->parts[part_nr];
-       index = index_inside_part(fa, element_nr);
        return &part->elements[index_inside_part(fa, element_nr)];
 }