Re: [PATCH v5 02/17] dmaengine: sh: rz-dmac: Fix incorrect NULL check on list_first_entry()
From: Claudiu Beznea
Date: Wed May 13 2026 - 10:42:49 EST
Hi, Frank,
On 5/12/26 23:35, Frank Li wrote:
On Tue, May 12, 2026 at 03:12:03PM +0300, Claudiu Beznea wrote:
The list passed as argument to list_first_entry() is expected to be not
empty.
Little confused,
#define list_first_entry_or_null(ptr, type, member) ({ \
struct list_head *head__ = (ptr); \
struct list_head *pos__ = READ_ONCE(head__->next); \
pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
})
both list passed to list_first_entry() or list_first_entry_or_null() must
be not NULL.
The intention was to to express that checking the pointer returned by list_first_entry() may lead to problems. I'll adjust the description to be more clear.
--
Thank you,
Claudiu