From: Gustavo Sverzut Barbieri Date: Sat, 17 Dec 2011 00:27:02 +0000 (-0200) Subject: fix kmod_list_prev(). X-Git-Tag: v2~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2a70a5d4e0e62313a905378d463bc5857c5eef0b;p=thirdparty%2Fkmod.git fix kmod_list_prev(). 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(). --- diff --git a/libkmod/libkmod-list.c b/libkmod/libkmod-list.c index 0015039b..5ec33a2a 100644 --- a/libkmod/libkmod-list.c +++ b/libkmod/libkmod-list.c @@ -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);