Re: [PATCH 06/10] dmaengine: fsldma: convert channel allocation to devm_kzalloc
From: Frank Li <hidden>
Date: 2026-06-05 22:46:02
Also in:
dmaengine, lkml, llvm
On Fri, Jun 05, 2026 at 03:01:30PM -0700, Rosen Penev wrote:
Convert fsl_dma_chan_probe from kzalloc_obj to devm_kzalloc, tying the channel lifetime to the parent DMA device. This removes the
Nit: Remove kfree(chan) in .. Reviewed-by: Frank Li <Frank.Li@nxp.com>
quoted hunk ↗ jump to hunk
need for kfree(chan) in both the probe error path and the remove function. Assisted-by: opencode:big-pickle Signed-off-by: Rosen Penev <redacted> --- drivers/dma/fsldma.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 2a6a247761a4..ee6e595c2972 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c@@ -1111,11 +1111,9 @@ static int fsl_dma_chan_probe(struct fsldma_device *fdev, int err; /* alloc channel */ - chan = kzalloc_obj(*chan); - if (!chan) { - err = -ENOMEM; - goto out_return; - } + chan = devm_kzalloc(fdev->dev, sizeof(*chan), GFP_KERNEL); + if (!chan) + return -ENOMEM; /* ioremap registers for use */ chan->regs = of_iomap(node, 0);@@ -1197,9 +1195,6 @@ static int fsl_dma_chan_probe(struct fsldma_device *fdev, out_iounmap_regs: iounmap(chan->regs); -out_free_chan: - kfree(chan); -out_return: return err; }@@ -1208,7 +1203,6 @@ static void fsl_dma_chan_remove(struct fsldma_chan *chan) tasklet_kill(&chan->tasklet); list_del(&chan->common.device_node); iounmap(chan->regs); - kfree(chan); } static int fsldma_of_probe(struct platform_device *op) --2.54.0