summaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/vpe.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-01 11:31:31 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-01 11:31:31 -0700
commit61434392f797cf89872bda87dff8b3395edf4108 (patch)
tree489e344b0a5142dd4dc74ba3f4972592b90bacec /arch/mips/kernel/vpe.c
parent0e45adb8f5371f3d20a6df21cd13ce32fbe9bf15 (diff)
parentf9e8b782608021c0cbd936923cc0e509521b594d (diff)
downloadop-kernel-dev-61434392f797cf89872bda87dff8b3395edf4108.zip
op-kernel-dev-61434392f797cf89872bda87dff8b3395edf4108.tar.gz
Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/ralf/upstream-linus
* 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/ralf/upstream-linus: [MIPS] XSS1500: Fix compilation [MIPS] Bigsur: make defconfig more useful. [MIPS] Alchemy: work around clock misdetection on early Au1000 [MIPS] Add missing 4KEC TLB refill handler [MIPS] BCM1480: Fix PCI/HT IO access [MIPS] Fix the installation condition of MIPS clocksource [MIPS] Check for GCC r10k-cache-barrier support [MIPS] I8253: Export i2853_lock to modules. [MIPS] VPE loader: Check result of memory allocation.
Diffstat (limited to 'arch/mips/kernel/vpe.c')
-rw-r--r--arch/mips/kernel/vpe.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index eed2dc4..39804c5 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -262,13 +262,21 @@ void dump_mtregs(void)
/* Find some VPE program space */
static void *alloc_progmem(unsigned long len)
{
+ void *addr;
+
#ifdef CONFIG_MIPS_VPE_LOADER_TOM
- /* this means you must tell linux to use less memory than you physically have */
- return pfn_to_kaddr(max_pfn);
+ /*
+ * This means you must tell Linux to use less memory than you
+ * physically have, for example by passing a mem= boot argument.
+ */
+ addr = pfn_to_kaddr(max_pfn);
+ memset(addr, 0, len);
#else
- // simple grab some mem for now
- return kmalloc(len, GFP_KERNEL);
+ /* simple grab some mem for now */
+ addr = kzalloc(len, GFP_KERNEL);
#endif
+
+ return addr;
}
static void release_progmem(void *ptr)
@@ -884,9 +892,10 @@ static int vpe_elfload(struct vpe * v)
}
v->load_addr = alloc_progmem(mod.core_size);
- memset(v->load_addr, 0, mod.core_size);
+ if (!v->load_addr)
+ return -ENOMEM;
- printk("VPE loader: loading to %p\n", v->load_addr);
+ pr_info("VPE loader: loading to %p\n", v->load_addr);
if (relocate) {
for (i = 0; i < hdr->e_shnum; i++) {
OpenPOWER on IntegriCloud