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

Commit 1234f5d7 authored by Jagadeesh's avatar Jagadeesh
Browse files

msm: ipa3: fix to cleanup the dma allocation.



When commit header table from memory to HW, adding fix to clean
dma allocation if it fails in multiple mapping attempts and also to
clean the allocated mapping of hdr table after commit to HW.

Change-Id: Icbf1b855e34625ffe8f8356a59cddf85a91b0160
Signed-off-by: default avatarJagadeesh Ponduru <quic_jponduru@quicinc.com>
parent 1ed7eace
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -190,13 +190,13 @@ int __ipa_commit_hdr_v3_0(void)

	if (ipa3_generate_hdr_hw_tbl(&hdr_mem)) {
		IPAERR("fail to generate HDR HW TBL\n");
		goto end;
		goto failure_hdr;
	}

	if (ipa3_generate_hdr_proc_ctx_hw_tbl(hdr_mem.phys_base, &ctx_mem,
	    &aligned_ctx_mem)) {
		IPAERR("fail to generate HDR PROC CTX HW TBL\n");
		goto end;
		goto failure_hdr_proc;
	}

	/* IC to close the coal frame before HPS Clear if coal is enabled */
@@ -322,6 +322,7 @@ int __ipa_commit_hdr_v3_0(void)
	else
		rc = 0;

end:
	if (ipa3_ctx->hdr_tbl_lcl) {
		dma_free_coherent(ipa3_ctx->pdev, hdr_mem.size, hdr_mem.base,
			hdr_mem.phys_base);
@@ -333,6 +334,9 @@ int __ipa_commit_hdr_v3_0(void)
				ipa3_ctx->hdr_mem.base,
				ipa3_ctx->hdr_mem.phys_base);
			ipa3_ctx->hdr_mem = hdr_mem;
		} else {
			dma_free_coherent(ipa3_ctx->pdev, hdr_mem.size,
			hdr_mem.base,hdr_mem.phys_base);
		}
	}

@@ -347,10 +351,12 @@ int __ipa_commit_hdr_v3_0(void)
					ipa3_ctx->hdr_proc_ctx_mem.base,
					ipa3_ctx->hdr_proc_ctx_mem.phys_base);
			ipa3_ctx->hdr_proc_ctx_mem = ctx_mem;
		} else {
			dma_free_coherent(ipa3_ctx->pdev, ctx_mem.size,
			ctx_mem.base,ctx_mem.phys_base);
		}
	}

end:
	if (coal_cmd_pyld)
		ipahal_destroy_imm_cmd(coal_cmd_pyld);

@@ -361,6 +367,12 @@ int __ipa_commit_hdr_v3_0(void)
		ipahal_destroy_imm_cmd(hdr_cmd_pyld);

	return rc;

failure_hdr_proc:
	dma_free_coherent(ipa3_ctx->pdev, hdr_mem.size, hdr_mem.base,
			hdr_mem.phys_base);
failure_hdr:
	return rc;
}

static int __ipa_add_hdr_proc_ctx(struct ipa_hdr_proc_ctx_add *proc_ctx,