--- ptrlist.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ptrlist.h b/ptrlist.h index 883cca952..f856a54eb 100644 --- a/ptrlist.h +++ b/ptrlist.h @@ -102,17 +102,13 @@ static inline void *first_ptr_list(struct ptr_list *list) static inline void *last_ptr_list(struct ptr_list *list) { - struct ptr_list *head = list; + struct ptr_cur cur; - if (!list) + if (!ptr_cur_end(&cur, list)) + return NULL; + if (!ptr_cur_prev(&cur)) return NULL; - list = list->prev; - while (list->nr == 0) { - if (list == head) - return NULL; - list = list->prev; - } - return PTR_ENTRY(list, list->nr-1); + return __PTR_STRIP_TAG(ptr_cur_entry(&cur)); } #define PTR_DEREF(__head, idx, PTR_ENTRY) ({ \ -- 2.13.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html