From patchwork Tue Oct 9 20:13:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 12080 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 811CC23F6D for ; Tue, 9 Oct 2012 20:14:10 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 325D9A18878 for ; Tue, 9 Oct 2012 20:14:10 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so12072696iej.11 for ; Tue, 09 Oct 2012 13:14:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-provags-id:x-gm-message-state; bh=yNHJRTvDFZgMk21b/wFJdcpYlj2h28K1Gk1r6T87f/U=; b=dUWUqrRrhyrjvy6z5qvH4x46BNHw78B0CH64Ow1WiqOkMmFhPxZUuipuqXlES105RO A26Pj6MWnZRZ57+fCA7lwv8dKG8CA75cztWHaLTctXblYMHFKaHsawcOZif/IVK8IF0Z hT61ULERYi5eIWlwuW8qk73p58RQIn4lGUyATJ78uV6kXt41LUxVbYoBn2v2PvSCRjea +aoyu88xxWof/qpZWirPcU/gK9Dj4bthvApOO+boCycwqn/tGWiTQrqMAASScqeFow5F TqRUC2BFbW6NDyWZjZuwCZl7p+F+p8ucPiZZSMZpMHreJxeBABoNn2BV1Pay7V7f4QXN Y2iA== Received: by 10.42.145.66 with SMTP id e2mr16520879icv.18.1349813649880; Tue, 09 Oct 2012 13:14:09 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp113873igt; Tue, 9 Oct 2012 13:14:08 -0700 (PDT) Received: by 10.204.147.89 with SMTP id k25mr7101815bkv.127.1349813648321; Tue, 09 Oct 2012 13:14:08 -0700 (PDT) Received: from moutng.kundenserver.de (moutng.kundenserver.de. [212.227.17.10]) by mx.google.com with ESMTPS id gi9si40124649bkc.134.2012.10.09.13.14.07 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Oct 2012 13:14:08 -0700 (PDT) Received-SPF: neutral (google.com: 212.227.17.10 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) client-ip=212.227.17.10; Authentication-Results: mx.google.com; spf=neutral (google.com: 212.227.17.10 is neither permitted nor denied by best guess record for domain of arnd@arndb.de) smtp.mail=arnd@arndb.de Received: from klappe2.lan (HSI-KBW-149-172-5-253.hsi13.kabel-badenwuerttemberg.de [149.172.5.253]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0Lowim-1TpFiS1jOO-00eqLE; Tue, 09 Oct 2012 22:14:04 +0200 From: Arnd Bergmann To: arm@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Arnd Bergmann , Pekka Enberg Subject: [PATCH v2 3/8] mm/slob: use min_t() to compare ARCH_SLAB_MINALIGN Date: Tue, 9 Oct 2012 22:13:53 +0200 Message-Id: <1349813638-4617-4-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1349813638-4617-1-git-send-email-arnd@arndb.de> References: <1349813638-4617-1-git-send-email-arnd@arndb.de> X-Provags-ID: V02:K0:H9Ddkcvhxw/aYf04rCHopIDJpzijy88GdIdwejCnkRu OBSXjHv5zboLGoPQtN+MgejkQAefpsdRNTKa7v6uTlmblraz2D Oak4ylPsNg4t8OqCXseitslXKRWNdcYFzwc+sWer6Y1ALWwHrN BqVQ3WOLi8Q8om5RW16eltCiMQ4M36a+69xE2kq8ExbSfwTEHz 166Frn7oYng9JDn+17ZIdDxk8DTovVo66L8OGYxzlayW8Tq59P vBgVh67K3g1VDnCrP9yPSOyvJlvmy0J9OJbBZp65TvSxxOoEVR 3vRnXBC3oLrhslz9oMChzAMAg6KNinHv/ey09dTULkXS8M7xUX TGvHGIvRKdpxsFBqpexX8xeRH6A187vlILHic54Um X-Gm-Message-State: ALoCoQm4zjsshUxtnLcy1yXAqlq/5mxPaCayA9Bd/vTgjUv4KsAX8ywAaYK9AmNon9llPVTrtuXe The definition of ARCH_SLAB_MINALIGN is architecture dependent and can be either of type size_t or int. Comparing that value with ARCH_KMALLOC_MINALIGN can cause harmless warnings on platforms where they are different. Since both are always small positive integer numbers, using the size_t type to compare them is safe and gets rid of the warning. Without this patch, building ARM collie_defconfig results in: mm/slob.c: In function '__kmalloc_node': mm/slob.c:431:152: warning: comparison of distinct pointer types lacks a cast [enabled by default] mm/slob.c: In function 'kfree': mm/slob.c:484:153: warning: comparison of distinct pointer types lacks a cast [enabled by default] mm/slob.c: In function 'ksize': mm/slob.c:503:153: warning: comparison of distinct pointer types lacks a cast [enabled by default] Signed-off-by: Arnd Bergmann Acked-by: Christoph Lameter Cc: Pekka Enberg --- mm/slob.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/slob.c b/mm/slob.c index 45d4ca7..497c55e 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -428,7 +428,7 @@ out: void *__kmalloc_node(size_t size, gfp_t gfp, int node) { unsigned int *m; - int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); + int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); void *ret; gfp &= gfp_allowed_mask; @@ -481,7 +481,7 @@ void kfree(const void *block) sp = virt_to_page(block); if (PageSlab(sp)) { - int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); + int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); unsigned int *m = (unsigned int *)(block - align); slob_free(m, *m + align); } else @@ -500,7 +500,7 @@ size_t ksize(const void *block) sp = virt_to_page(block); if (PageSlab(sp)) { - int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); + int align = max_t(size_t, ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN); unsigned int *m = (unsigned int *)(block - align); return SLOB_UNITS(*m) * SLOB_UNIT; } else