Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b046c6fe authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Revert "dmaengine: imx-sdma: Fix memory leak"



This reverts commit af8eca60 which is
commit 02939cd167095f16328a1bd5cab5a90b550606df upstream.

Andreas writes:
	This patch breaks our imx6 board with the attached trace.
	Reverting the patch makes it boot again.

Reported-by: default avatarAndreas Tobler <andreas.tobler@onway.ch>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Robin Gong <yibin.gong@nxp.com>
Cc: Vinod Koul <vkoul@kernel.org>
Cc: Sasha Levin <sashal@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent cd26d53a
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -738,7 +738,11 @@ static void sdma_start_desc(struct sdma_channel *sdmac)
		return;
	}
	sdmac->desc = desc = to_sdma_desc(&vd->tx);

	/*
	 * Do not delete the node in desc_issued list in cyclic mode, otherwise
	 * the desc allocated will never be freed in vchan_dma_desc_free_list
	 */
	if (!(sdmac->flags & IMX_DMA_SG_LOOP))
		list_del(&vd->node);

	sdma->channel_control[channel].base_bd_ptr = desc->bd_phys;
@@ -1040,6 +1044,7 @@ static void sdma_channel_terminate_work(struct work_struct *work)

	spin_lock_irqsave(&sdmac->vc.lock, flags);
	vchan_get_all_descriptors(&sdmac->vc, &head);
	sdmac->desc = NULL;
	spin_unlock_irqrestore(&sdmac->vc.lock, flags);
	vchan_dma_desc_free_list(&sdmac->vc, &head);
}
@@ -1047,19 +1052,11 @@ static void sdma_channel_terminate_work(struct work_struct *work)
static int sdma_disable_channel_async(struct dma_chan *chan)
{
	struct sdma_channel *sdmac = to_sdma_chan(chan);
	unsigned long flags;

	spin_lock_irqsave(&sdmac->vc.lock, flags);

	sdma_disable_channel(chan);

	if (sdmac->desc) {
		vchan_terminate_vdesc(&sdmac->desc->vd);
		sdmac->desc = NULL;
	if (sdmac->desc)
		schedule_work(&sdmac->terminate_worker);
	}

	spin_unlock_irqrestore(&sdmac->vc.lock, flags);

	return 0;
}