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

Commit 61addc66 authored by Sravankumar bijili's avatar Sravankumar bijili Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Fix NULL pointer dereference in gmu_memory_close()



gmu_memory_probe() will happen after gmu_clock_probe(). Incase
devm_clk_get() returns error in gmu_probe, which can result into
NULL pointer dereference in gmu_memory_close(). So add a NULL
check before calling any iommu APIs from gmu_memory_close().

Change-Id: I4a0e3b839ddaa4e70d939700aa8bffa628f5f4ea
Signed-off-by: default avatarSravankumar bijili <csbijil@codeaurora.org>
parent d65a1eeb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -383,6 +383,9 @@ static void gmu_memory_close(struct gmu_device *gmu)
		md = &gmu->kmem_entries[i];
		ctx = &gmu_ctx[md->ctx_idx];

		if (!ctx->domain)
			continue;

		if (md->gmuaddr && md->mem_type != GMU_ITCM &&
				md->mem_type != GMU_DTCM)
			iommu_unmap(ctx->domain, md->gmuaddr, md->size);