From 2a70a5d4e0e62313a905378d463bc5857c5eef0b Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Fri, 16 Dec 2011 22:27:02 -0200 Subject: [PATCH] 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(). --- libkmod/libkmod-list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.2