diff options
author | Hugh Dickins <hughd@google.com> | 2011-07-11 16:35:08 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2011-07-18 08:20:49 -0400 |
commit | c225150b86fef9f7663219b6e9f7606ea1607312 (patch) | |
tree | c49c07c9ecaff0a90355fbb79f3e3d262fa5943a /mm/slab.c | |
parent | bfa71457a091ac0e4e20cab36e8ebad63935e504 (diff) |
slab: fix DEBUG_SLAB build
Fix CONFIG_SLAB=y CONFIG_DEBUG_SLAB=y build error and warnings.
Now that ARCH_SLAB_MINALIGN defaults to __alignof__(unsigned long long),
it is always defined (when slab.h included), but cannot be used in #if:
mm/slab.c: In function `cache_alloc_debugcheck_after':
mm/slab.c:3156:5: warning: "__alignof__" is not defined
mm/slab.c:3156:5: error: missing binary operator before token "("
make[1]: *** [mm/slab.o] Error 1
So just remove the #if and #endif lines, but then 64-bit build warns:
mm/slab.c: In function `cache_alloc_debugcheck_after':
mm/slab.c:3156:6: warning: cast from pointer to integer of different size
mm/slab.c:3158:10: warning: format `%d' expects type `int', but argument
3 has type `long unsigned int'
Fix those with casts, whatever the actual type of ARCH_SLAB_MINALIGN.
Acked-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slab.c')
-rw-r--r-- | mm/slab.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -3153,12 +3153,10 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, | |||
3153 | objp += obj_offset(cachep); | 3153 | objp += obj_offset(cachep); |
3154 | if (cachep->ctor && cachep->flags & SLAB_POISON) | 3154 | if (cachep->ctor && cachep->flags & SLAB_POISON) |
3155 | cachep->ctor(objp); | 3155 | cachep->ctor(objp); |
3156 | #if ARCH_SLAB_MINALIGN | 3156 | if ((unsigned long)objp & (ARCH_SLAB_MINALIGN-1)) { |
3157 | if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) { | ||
3158 | printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n", | 3157 | printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n", |
3159 | objp, ARCH_SLAB_MINALIGN); | 3158 | objp, (int)ARCH_SLAB_MINALIGN); |
3160 | } | 3159 | } |
3161 | #endif | ||
3162 | return objp; | 3160 | return objp; |
3163 | } | 3161 | } |
3164 | #else | 3162 | #else |