From patchwork Tue Jul 22 18:10:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himangi Saraogi X-Patchwork-Id: 372568 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DFCEE140190 for ; Wed, 23 Jul 2014 04:11:04 +1000 (EST) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id C77931A0949 for ; Wed, 23 Jul 2014 04:11:04 +1000 (EST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pd0-x22b.google.com (mail-pd0-x22b.google.com [IPv6:2607:f8b0:400e:c02::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 568731A01BD for ; Wed, 23 Jul 2014 04:10:29 +1000 (EST) Received: by mail-pd0-f171.google.com with SMTP id z10so28010pdj.16 for ; Tue, 22 Jul 2014 11:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=f1MP7oXU2liMHC0+TzV8q339AaNDybihjpT2nUr3ACg=; b=oIig87Lovd62yd3+n+C+LbuRpLvz0FCg4AbZFMuHjxXfB/WhvypuVT3xgDdC9J7TV5 5lKwkJZvRiF3VDUytX7NN/2V96OxKlqf87+UH9PiKcPj/fhe2hsTYwK+Mh8pLSE807/L fDP2rsagG2LFOHWAWWzMkSQtOZxm9OIS4Rs3xSP2eoiUXn9v2w5MnP1l1Bcs1Z4ZT7Dz Npd9TduTSqGzAw49v1UF6eETBwx+q5BXWjd0pc0MKBqJ42q/Fev7dKtSVgNE9Exg9Fio JrNFV0TQGQOSPaSyy4BjYx2SHiAgUbAA4mdPNeiIWSckokAaIsy+RjUYxyRwuc0PGaqU Xavg== X-Received: by 10.70.34.169 with SMTP id a9mr4180514pdj.28.1406052626918; Tue, 22 Jul 2014 11:10:26 -0700 (PDT) Received: from localhost ([122.164.52.8]) by mx.google.com with ESMTPSA id da14sm3809131pac.24.2014.07.22.11.10.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 22 Jul 2014 11:10:26 -0700 (PDT) Date: Tue, 22 Jul 2014 23:40:19 +0530 From: Himangi Saraogi To: Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] powerpc/perf/hv-24x7: Use kmem_cache_free Message-ID: <20140722181019.GA3222@himangi-Dell> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Julia Lawall X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Free memory allocated using kmem_cache_zalloc using kmem_cache_free rather than kfree. The Coccinelle semantic patch that makes this change is as follows: // @@ expression x,E,c; @@ x = \(kmem_cache_alloc\|kmem_cache_zalloc\|kmem_cache_alloc_node\)(c,...) ... when != x = E when != &x ?-kfree(x) +kmem_cache_free(c,x) // Signed-off-by: Himangi Saraogi Acked-by: Julia Lawall --- arch/powerpc/perf/hv-24x7.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 66d0f17..70d4f74 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c @@ -223,7 +223,7 @@ e_free: pr_err("h_get_24x7_catalog_page(ver=%lld, page=%lld) failed:" " rc=%ld\n", catalog_version_num, page_offset, hret); - kfree(page); + kmem_cache_free(hv_page_cache, page); pr_devel("catalog_read: offset=%lld(%lld) count=%zu(%zu) catalog_len=%zu(%zu) => %zd\n", offset, page_offset, count, page_count, catalog_len,