From patchwork Thu Dec 8 14:35:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9466473 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CADB8607D3 for ; Thu, 8 Dec 2016 14:37:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCF83283FE for ; Thu, 8 Dec 2016 14:37:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1EC828510; Thu, 8 Dec 2016 14:37:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0EA04283FE for ; Thu, 8 Dec 2016 14:37:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cEzo8-00067X-1T; Thu, 08 Dec 2016 14:36:24 +0000 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cEzo3-0005yp-2h for linux-arm-kernel@lists.infradead.org; Thu, 08 Dec 2016 14:36:19 +0000 Received: by mail-pg0-x241.google.com with SMTP id 3so27065783pgd.0 for ; Thu, 08 Dec 2016 06:35:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=aNmScbnV51GIQvixWmmsRc5HHKpZnta0iGPL8bYNjY4=; b=t9s/FhdE/8AwrdeP4ROs708Xz4lMJXQYWmu4yIDSlaTQWHNxxqbl097MpB/0iih+yR t+yT5/HYZ2crTOvQZpEw2ZYjCs+8FnGp/GmQ5Eohs1UenTUQ6rYROi44pXNgmTJ2seU3 RlklItJhjf2ghg31CWe7QaAVqyF3P2q5EgfsIMY4qfPaxdS7rtGfHwv/ezds1C0mjCjF JKy3SJghmzVvsO8FdFlHIFbwgmYNmfKimqaJGcsBIBlfVHD/78H1K2fkzAgyi9hBNDGs bpjrGLc65q5VEOMI7hlWOOoKYj39eEIBoNtCl+qbtpW1Agw8Uc/cLihO4aVQ5lfbTgfo u6fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aNmScbnV51GIQvixWmmsRc5HHKpZnta0iGPL8bYNjY4=; b=UfxcydB9JqJSx8V4yerXTBRfyLko1dYytg49jjyCOs+LVF1bRKKNpUaDAOZoeO0o5p xeW9LVz3LZth2zsKlYWKMWfpOVUugPrhjMOF1P29Ak9dj+F2kAsaZiYDIPEGCpY6TXnq Hc7grxScTNsUvvSFifFRstyylXlAoxUCfcjN2I2DLTQH7liHX5xnzJKNKTn9c8LgZpBH NX6EvyxO93Zr3RGY7c0nttUnPXiiQFb5K9bROxJ2Q5LMJuRIrFNKUjJ4cFUS04oPZ8Nq KorDgeZPdx9PLmGd3ngF39SH7/8GcBm+OqK68Rw/1XHC30GMW9dQasYbZsDIAU6/aegz Nl6w== X-Gm-Message-State: AKaTC00tHlrupeghOn5v7W1XpUkE1ydgPLPc/72oiGkbLTjcg1dqKgcuYCOWNfF3EjdWHA== X-Received: by 10.98.64.195 with SMTP id f64mr73496043pfd.16.1481207757991; Thu, 08 Dec 2016 06:35:57 -0800 (PST) Received: from localhost.localdomain ([103.16.70.188]) by smtp.gmail.com with ESMTPSA id r2sm50774881pfi.67.2016.12.08.06.35.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Dec 2016 06:35:56 -0800 (PST) From: Arvind Yadav To: daniel@zonque.org, haojian.zhuang@gmail.com, robert.jarzmik@free.fr, linus.walleij@linaro.org Subject: [PATCH V1] pinctrl:pxa:pinctrl-pxa2xx:- No need of devm functions Date: Thu, 8 Dec 2016 20:05:30 +0530 Message-Id: <1481207730-6332-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161208_063619_201090_ADFD64E0 X-CRM114-Status: GOOD ( 11.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In functions pxa2xx_build_functions, the memory allocated for 'functions' is live within the function only. After the allocation it is immediately freed with devm_kfree. There is no need to allocate memory for 'functions' with devm function so replace devm_kcalloc with kcalloc and devm_kfree with kfree. Signed-off-by: Arvind Yadav --- drivers/pinctrl/pxa/pinctrl-pxa2xx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/pxa/pinctrl-pxa2xx.c b/drivers/pinctrl/pxa/pinctrl-pxa2xx.c index 866aa3c..47b8e3a 100644 --- a/drivers/pinctrl/pxa/pinctrl-pxa2xx.c +++ b/drivers/pinctrl/pxa/pinctrl-pxa2xx.c @@ -277,7 +277,7 @@ static int pxa2xx_build_functions(struct pxa_pinctrl *pctl) * alternate function, 6 * npins is an absolute high limit of the number * of functions. */ - functions = devm_kcalloc(pctl->dev, pctl->npins * 6, + functions = kcalloc(pctl->npins * 6, sizeof(*functions), GFP_KERNEL); if (!functions) return -ENOMEM; @@ -289,10 +289,12 @@ static int pxa2xx_build_functions(struct pxa_pinctrl *pctl) pctl->functions = devm_kmemdup(pctl->dev, functions, pctl->nfuncs * sizeof(*functions), GFP_KERNEL); - if (!pctl->functions) + if (!pctl->functions) { + kfree(functions); return -ENOMEM; + } - devm_kfree(pctl->dev, functions); + kfree(functions); return 0; }