From patchwork Fri Oct 5 14:55:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 12019 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 BD7BD23E57 for ; Fri, 5 Oct 2012 14:56:19 +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 7288DA190DA for ; Fri, 5 Oct 2012 14:56:19 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so3893159iej.11 for ; Fri, 05 Oct 2012 07:56:19 -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=VDKXX8owwv102tmAEH8YHAwYEbrP9fYBn4o+E7TTrvY=; b=T8fZ3u0MyD8fzlJ25cDuDU80nXePa5gzh8Infp/e0yVbC+Mu4p9KtpfvYqVSwY2wd4 6Bs5NQfiJDIWkFI51NqQxoWvEqABdm4WvkpeLgv9JvvT+9T0i3zCnE2D6cHRLu9s2VtR T0dXi1gfO6gNYiOy+H6XSSGi0VZHLZq19TBDFbdp4dcwvFmDg5dvvudjld9s7ye3/H1n c4YyhEvTgZwn9P7hfbdpjJBHQ2VG4DzNbAmTGxnNFQRlcPMVa5fEl8K8RjMlinfDCclO 0pXFIsrCfK9VepH2tfKsJILGjXap0LQhkVHL2Eny/RYOP8BwZS2PPYFr7Q+ZeQMPlZZx aFKg== Received: by 10.50.154.137 with SMTP id vo9mr1396510igb.28.1349448979138; Fri, 05 Oct 2012 07:56:19 -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.184.232 with SMTP id ex8csp130662igc; Fri, 5 Oct 2012 07:56:18 -0700 (PDT) Received: by 10.204.150.141 with SMTP id y13mr2859982bkv.1.1349448977655; Fri, 05 Oct 2012 07:56:17 -0700 (PDT) Received: from moutng.kundenserver.de (moutng.kundenserver.de. [212.227.17.10]) by mx.google.com with ESMTPS id ig14si18929106bkc.130.2012.10.05.07.56.17 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 05 Oct 2012 07:56:17 -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.boeblingen.de.ibm.com (deibp9eh1--blueice3n2.emea.ibm.com [195.212.29.180]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0M6c40-1TeorP29eG-00wW00; Fri, 05 Oct 2012 16:55:47 +0200 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, arm@kernel.org, Arnd Bergmann , Christoph Lameter , Pekka Enberg Subject: [PATCH 06/16] mm/slob: use min_t() to compare ARCH_SLAB_MINALIGN Date: Fri, 5 Oct 2012 16:55:20 +0200 Message-Id: <1349448930-23976-7-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1349448930-23976-1-git-send-email-arnd@arndb.de> References: <1349448930-23976-1-git-send-email-arnd@arndb.de> X-Provags-ID: V02:K0:USz0MW8FHEbHrDYmVpUP3B4yrJ7vIv+hy6kHPEnO/lP HFcGNdSR0qpQvkynOuKo6gDO+SWAur1p8qnQ90xy++yhTlfs2t z3CsjWd6KcjGN0JNPdezFA4bo8Z9KnK/RxBURoh7vYXewTuRwB KCokkUWKHsi1919ZI5qocu2A6lNzmQygOmxbEtS+EONXzXmHvv m2teVjZqVRuQ09CT5Ssh/OS8JmDnAoOC1s+T0/v6ubRASphvob xNTn4DBQcf3Zrwjd/HbkGOy1enoXQKe4R2bd1x1WdYYr4as4Tp V/t+OpsOsayQ9cQcUfEhVKSnvIGsm/ShIF3EXiqKSE8JiJOiOw jyoDoPbpI+Gqc4T6P8J8i6x753jAQ6SMn8jxyGOrnWZsou7KWa 9mRkaMGinIrIvbLpEfqm96F4VbJDj1hPMY= X-Gm-Message-State: ALoCoQkHKVLR2aj4vUaqhwC6iIu53YWuWsZyBWsdJkiCiC6O79Z18DbvjcO1z4x52xQDtHb3gf6/ 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 Cc: 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