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

Commit 8b20da6f authored by Hareesh Gundu's avatar Hareesh Gundu
Browse files

msm: kgsl: Remove BUG_ON from the map global



Return error instead of BUG_ON on map global failure.
This will avoid crashing the entire system.

CRs-Fixed: 1106621
Change-Id: I693dc196bb7a2e01f6a033f5fbbf7b454108108d
Signed-off-by: default avatarHareesh Gundu <hareeshg@codeaurora.org>
parent c88fe01f
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2017, 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
@@ -134,7 +134,7 @@ static void kgsl_iommu_unmap_globals(struct kgsl_pagetable *pagetable)
	}
}

static void kgsl_iommu_map_globals(struct kgsl_pagetable *pagetable)
static int kgsl_iommu_map_globals(struct kgsl_pagetable *pagetable)
{
	unsigned int i;

@@ -143,9 +143,11 @@ static void kgsl_iommu_map_globals(struct kgsl_pagetable *pagetable)
			int ret = kgsl_mmu_map(pagetable,
					global_pt_entries[i].memdesc);

			BUG_ON(ret);
			if (ret)
				return ret;
		}
	}
	return 0;
}

static void kgsl_iommu_unmap_global_secure_pt_entry(struct kgsl_pagetable
@@ -158,16 +160,16 @@ static void kgsl_iommu_unmap_global_secure_pt_entry(struct kgsl_pagetable

}

static void kgsl_map_global_secure_pt_entry(struct kgsl_pagetable *pagetable)
static int kgsl_map_global_secure_pt_entry(struct kgsl_pagetable *pagetable)
{
	int ret;
	int ret = 0;
	struct kgsl_memdesc *entry = kgsl_global_secure_pt_entry;

	if (entry != NULL) {
		entry->pagetable = pagetable;
		ret = kgsl_mmu_map(pagetable, entry);
		BUG_ON(ret);
	}
	return ret;
}

static void kgsl_iommu_remove_global(struct kgsl_mmu *mmu,
@@ -1171,7 +1173,7 @@ static int _init_global_pt(struct kgsl_mmu *mmu, struct kgsl_pagetable *pt)
		goto done;
	}

	kgsl_iommu_map_globals(pt);
	ret = kgsl_iommu_map_globals(pt);

done:
	if (ret)
@@ -1227,7 +1229,7 @@ static int _init_secure_pt(struct kgsl_mmu *mmu, struct kgsl_pagetable *pt)
	ctx->regbase = iommu->regbase + KGSL_IOMMU_CB0_OFFSET
			+ (cb_num << KGSL_IOMMU_CB_SHIFT);

	kgsl_map_global_secure_pt_entry(pt);
	ret = kgsl_map_global_secure_pt_entry(pt);

done:
	if (ret)
@@ -1288,7 +1290,7 @@ static int _init_per_process_pt(struct kgsl_mmu *mmu, struct kgsl_pagetable *pt)
		goto done;
	}

	kgsl_iommu_map_globals(pt);
	ret = kgsl_iommu_map_globals(pt);

done:
	if (ret)