]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dmaengine: sh: rz-dmac: Fix incorrect NULL check for list_first_entry()
authorClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tue, 26 May 2026 08:46:54 +0000 (11:46 +0300)
committerVinod Koul <vkoul@kernel.org>
Thu, 4 Jun 2026 15:28:30 +0000 (20:58 +0530)
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 <john.madieu.xa@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tested-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Link: https://patch.msgid.link/20260526084710.3491480-3-claudiu.beznea@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/sh/rz-dmac.c

index 9f206a33dcc6b10a43d87c18f1dbf72793f1c585..6d80cb668957fb5334bf2d5104e9a321fdcf32fd 100644 (file)
@@ -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;