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

Commit 213ebb41 authored by Ravinder Konka's avatar Ravinder Konka
Browse files

msm: ipa: Fix memory free issue



When calling dma_free_coherent, there is a possibility that
size 0 is passed as argument which can result into panic.
Make a change to check for the size before calling the API.

Change-Id: Idb248e1270b79b51e53de687793030a047fe6c73
Acked-by: default avatarChaitanya Pratapa <cpratapa@qti.qualcomm.com>
Signed-off-by: default avatarRavinder Konka <rkonka@codeaurora.org>
parent 480aa758
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2016, 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
@@ -660,7 +660,9 @@ static int ipa_generate_rt_hw_tbl_v2(enum ipa_ip_type ip,
	return 0;

proc_err:
	dma_free_coherent(ipa_ctx->pdev, mem->size, mem->base, mem->phys_base);
	if (mem->size)
		dma_free_coherent(ipa_ctx->pdev, mem->size, mem->base,
			mem->phys_base);
base_err:
	dma_free_coherent(ipa_ctx->pdev, head->size, head->base,
			head->phys_base);