From: Claudiu Beznea Date: Tue, 26 May 2026 08:46:54 +0000 (+0300) Subject: dmaengine: sh: rz-dmac: Fix incorrect NULL check for list_first_entry() X-Git-Tag: v7.2-rc1~55^2~43 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=5fbf3a2a3b96ef5810e6e0fbc601f82067629bc5;p=thirdparty%2Fkernel%2Flinux.git dmaengine: sh: rz-dmac: Fix incorrect NULL check for list_first_entry() list_first_entry() does not return NULL when the list is empty, making the existing NULL check invalid. Use list_first_entry_or_null() instead. Fixes: 21323b118c16 ("dmaengine: sh: rz-dmac: Add device_tx_status() callback") Cc: stable@vger.kernel.org Tested-by: John Madieu Signed-off-by: Claudiu Beznea Tested-by: Tommaso Merciai Link: https://patch.msgid.link/20260526084710.3491480-3-claudiu.beznea@kernel.org Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c index 9f206a33dcc6b..6d80cb668957f 100644 --- a/drivers/dma/sh/rz-dmac.c +++ b/drivers/dma/sh/rz-dmac.c @@ -723,8 +723,8 @@ static u32 rz_dmac_chan_get_residue(struct rz_dmac_chan *channel, u32 crla, crtb, i; /* Get current processing virtual descriptor */ - current_desc = list_first_entry(&channel->ld_active, - struct rz_dmac_desc, node); + current_desc = list_first_entry_or_null(&channel->ld_active, + struct rz_dmac_desc, node); if (!current_desc) return 0;