X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fia64%2Fsn%2Fkernel%2Fxpc_partition.c;h=372c8f476316f9a977c69206de4b71a639162868;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=57c723f5cba404f5cda5fbefd6a370c97bc328df;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/arch/ia64/sn/kernel/xpc_partition.c b/arch/ia64/sn/kernel/xpc_partition.c index 57c723f5c..372c8f476 100644 --- a/arch/ia64/sn/kernel/xpc_partition.c +++ b/arch/ia64/sn/kernel/xpc_partition.c @@ -76,31 +76,6 @@ char *xpc_remote_copy_buffer; void *xpc_remote_copy_buffer_base; -/* - * Guarantee that the kmalloc'd memory is cacheline aligned. - */ -void * -xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base) -{ - /* see if kmalloc will give us cachline aligned memory by default */ - *base = kmalloc(size, flags); - if (*base == NULL) { - return NULL; - } - if ((u64) *base == L1_CACHE_ALIGN((u64) *base)) { - return *base; - } - kfree(*base); - - /* nope, we'll have to do it ourselves */ - *base = kmalloc(size + L1_CACHE_BYTES, flags); - if (*base == NULL) { - return NULL; - } - return (void *) L1_CACHE_ALIGN((u64) *base); -} - - /* * Given a nasid, get the physical address of the partition's reserved page * for that nasid. This function returns 0 on any error. @@ -132,7 +107,9 @@ xpc_get_rsvd_page_pa(int nasid) } if (L1_CACHE_ALIGN(len) > buf_len) { - kfree(buf_base); + if (buf_base != NULL) { + kfree(buf_base); + } buf_len = L1_CACHE_ALIGN(len); buf = (u64) xpc_kmalloc_cacheline_aligned(buf_len, GFP_KERNEL, &buf_base); @@ -153,7 +130,9 @@ xpc_get_rsvd_page_pa(int nasid) } } - kfree(buf_base); + if (buf_base != NULL) { + kfree(buf_base); + } if (status != SALRET_OK) { rp_pa = 0; @@ -1051,12 +1030,13 @@ xpc_discovery(void) remote_vars = (struct xpc_vars *) remote_rp; - discovered_nasids = kzalloc(sizeof(u64) * xp_nasid_mask_words, + discovered_nasids = kmalloc(sizeof(u64) * xp_nasid_mask_words, GFP_KERNEL); if (discovered_nasids == NULL) { kfree(remote_rp_base); return; } + memset(discovered_nasids, 0, sizeof(u64) * xp_nasid_mask_words); rp = (struct xpc_rsvd_page *) xpc_rsvd_page;