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

Commit bdd03e17 authored by Prudhvi Yarlagadda's avatar Prudhvi Yarlagadda Committed by Gerrit - the friendly Code Review server
Browse files

slim-msm.c: Check for iommu dev before dma_free_coherent



Add a check for iommu device handler before doing dma_free_coherent
as a part of SSR clean up.
This fixes the kernel page table corruption happening due to wrong
device handler used during freeing the resources during SSR cleanup.
This change ensures we use same dev handle for allocating and
freeing the DMA memory.

Change-Id: Ic42d42446dd9954f9c1fc7d282b03d1fa4bc4980
Signed-off-by: default avatarPrudhvi Yarlagadda <pyarlaga@codeaurora.org>
parent d4afd5e4
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
/* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -243,8 +243,11 @@ int msm_slim_sps_mem_alloc(
void
msm_slim_sps_mem_free(struct msm_slim_ctrl *dev, struct sps_mem_buffer *mem)
{
	struct device *dma_dev = dev->iommu_desc.cb_dev ?
					dev->iommu_desc.cb_dev : dev->dev;

	if (mem->base && mem->phys_base)
		dma_free_coherent(dev->dev, mem->size, mem->base,
		dma_free_coherent(dma_dev, mem->size, mem->base,
							mem->phys_base);
	else
		dev_err(dev->dev, "cant dma free. they are NULL\n");