]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
fix kmod_list_prev().
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sat, 17 Dec 2011 00:27:02 +0000 (22:27 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Sat, 17 Dec 2011 21:43:11 +0000 (19:43 -0200)
kmod_list_prev() should return NULL if the current element is the
head, not if the previous element is the head. This was likely a copy
& paste error from kmod_list_next().

libkmod/libkmod-list.c

index 0015039b2733b6cfee4e0115477fdf4dd730ae1f..5ec33a2a2d10eeb02556fcb1d0b22aa2185f6002 100644 (file)
@@ -280,7 +280,7 @@ KMOD_EXPORT struct kmod_list *kmod_list_prev(const struct kmod_list *list,
        if (list == NULL || curr == NULL)
                return NULL;
 
-       if (curr->node.prev == &list->node)
+       if (list == curr)
                return NULL;
 
        return container_of(curr->node.prev, struct kmod_list, node);