Commit 923b1383 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Vinod Koul
Browse files

dmaengine: mcf-edma: Use struct_size()



Use struct_size() instead of hand writing it.
This is less verbose and more informative.

'mcf_chan' is now unused and can be removed. In fact, it is shadowed by
another variable in the 'for' loop below. Keep this one.

Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/97c2bb1c9b69d0739da3762a7752ae6582c4ad02.1683390112.git.christophe.jaillet@wanadoo.fr


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 8674ca39
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -180,9 +180,8 @@ static int mcf_edma_probe(struct platform_device *pdev)
{
	struct mcf_edma_platform_data *pdata;
	struct fsl_edma_engine *mcf_edma;
	struct fsl_edma_chan *mcf_chan;
	struct edma_regs *regs;
	int ret, i, len, chans;
	int ret, i, chans;

	pdata = dev_get_platdata(&pdev->dev);
	if (!pdata) {
@@ -191,8 +190,8 @@ static int mcf_edma_probe(struct platform_device *pdev)
	}

	chans = pdata->dma_channels;
	len = sizeof(*mcf_edma) + sizeof(*mcf_chan) * chans;
	mcf_edma = devm_kzalloc(&pdev->dev, len, GFP_KERNEL);
	mcf_edma = devm_kzalloc(&pdev->dev, struct_size(mcf_edma, chans, chans),
				GFP_KERNEL);
	if (!mcf_edma)
		return -ENOMEM;