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

Commit 23b43751 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa3: Fix to memory allocation failure"

parents 493f9f8e 12d13d3f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ static int ipa3_generate_hdr_proc_ctx_hw_tbl(u64 hdr_sys_addr,
	struct ipa_mem_buffer *mem, struct ipa_mem_buffer *aligned_mem)
{
	u64 hdr_base_addr;
	gfp_t flag = GFP_KERNEL;

	mem->size = (ipa3_ctx->hdr_proc_ctx_tbl.end) ? : 4;

@@ -129,9 +130,14 @@ static int ipa3_generate_hdr_proc_ctx_hw_tbl(u64 hdr_sys_addr,

	IPADBG_LOW("tbl_sz=%d\n", ipa3_ctx->hdr_proc_ctx_tbl.end);

alloc:
	mem->base = dma_alloc_coherent(ipa3_ctx->pdev, mem->size,
			&mem->phys_base, GFP_KERNEL);
			&mem->phys_base, flag);
	if (!mem->base) {
		if (flag == GFP_KERNEL) {
			flag = GFP_ATOMIC;
			goto alloc;
		}
		IPAERR("fail to alloc DMA buff of size %d\n", mem->size);
		return -ENOMEM;
	}
+13 −2
Original line number Diff line number Diff line
@@ -4009,6 +4009,7 @@ static int ipa_fltrt_alloc_lcl_bdy(
	struct ipahal_fltrt_alloc_imgs_params *params)
{
	struct ipahal_fltrt_obj *obj;
	gfp_t flag = GFP_KERNEL;

	obj = &ipahal_fltrt_objs[ipahal_ctx->hw_type];

@@ -4041,10 +4042,15 @@ static int ipa_fltrt_alloc_lcl_bdy(
		IPAHAL_DBG_LOW("nhash lcl tbl bdy total h/w size = %u\n",
			params->nhash_bdy.size);

alloc1:
		params->nhash_bdy.base = dma_zalloc_coherent(
			ipahal_ctx->ipa_pdev, params->nhash_bdy.size,
			&params->nhash_bdy.phys_base, GFP_KERNEL);
			&params->nhash_bdy.phys_base, flag);
		if (!params->nhash_bdy.base) {
			if (flag == GFP_KERNEL) {
				flag = GFP_ATOMIC;
				goto alloc1;
			}
			IPAHAL_ERR("fail to alloc DMA buff of size %d\n",
				params->nhash_bdy.size);
			return -ENOMEM;
@@ -4071,10 +4077,15 @@ static int ipa_fltrt_alloc_lcl_bdy(
		IPAHAL_DBG_LOW("hash lcl tbl bdy total h/w size = %u\n",
			params->hash_bdy.size);

alloc2:
		params->hash_bdy.base = dma_zalloc_coherent(
			ipahal_ctx->ipa_pdev, params->hash_bdy.size,
			&params->hash_bdy.phys_base, GFP_KERNEL);
			&params->hash_bdy.phys_base, flag);
		if (!params->hash_bdy.base) {
			if (flag == GFP_KERNEL) {
				flag = GFP_ATOMIC;
				goto alloc2;
			}
			IPAHAL_ERR("fail to alloc DMA buff of size %d\n",
				params->hash_bdy.size);
			goto hash_bdy_fail;