From patchwork Wed Apr 26 15:34:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9701567 X-Patchwork-Delegate: eduardo.valentin@ti.com 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 6444B6032C for ; Wed, 26 Apr 2017 15:39:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B3FE27D0E for ; Wed, 26 Apr 2017 15:39:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E8B528418; Wed, 26 Apr 2017 15:39:19 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2E7D27D0E for ; Wed, 26 Apr 2017 15:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964891AbdDZPgd (ORCPT ); Wed, 26 Apr 2017 11:36:33 -0400 Received: from mout.web.de ([217.72.192.78]:50289 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936946AbdDZPfA (ORCPT ); Wed, 26 Apr 2017 11:35:00 -0400 Received: from [192.168.1.2] ([77.182.112.5]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MAdst-1dFBLZ2Nel-00Bplt; Wed, 26 Apr 2017 17:34:46 +0200 Subject: [PATCH 1/3] ti-soc-thermal: Use devm_kcalloc() in ti_bandgap_build() From: SF Markus Elfring To: linux-pm@vger.kernel.org, linux-omap@vger.kernel.org, Eduardo Valentin , Keerthy , Zhang Rui Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <071d2e92-0bcc-5ccc-ad28-b05a72538d6b@users.sourceforge.net> Date: Wed, 26 Apr 2017 17:34:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:ZgMRtw6s/uQNRSMwfFWDjqtBEMctk1FUSqMCVfCW1nLwIiwlLwB ONBo6wExFiZA26qvuGlDBU34OKK9CHpZ1hjZNjz+FlAUITPGnsHDmE0NSBv0Te17YUQxzLT 3nOPDrgsu2Agi/3Mhokmg7L5vRMp5TsqMjZ2mWS6MztufRn+DMZucSLw75zi6AqNGJggcp5 ZotdYZxniBqRChZdwFthw== X-UI-Out-Filterresults: notjunk:1; V01:K0:zwnm7jHq2Lc=:zBquzZaPz+wzR8h22esVUe K+X5n5Y2GDYvuCcIeZ0xL8fqfevohBWmhEvrk9zMrW8n4hprSWaPD3WEYQ6bnZA2Pea8qdV7e GdokgzMMUE8938KabbR4p57NcVLGT2Ou/HQSTayjWtv926YIAiUadd/O3hoTKtmq6K2eKS5uB BBYQYGVagRWyBNHyzzfcsh/ElKekmvjhvWrd7Jfp2wZBXEOlU1Yy4iB5bis7TIdpZZ4BAbI2O 3we/KVQJ4Ca++zgWxhfBDe9cdoahJnHE+EkbdMBkTOPNa5HIIpIOcDNKBSrGRCGmfnr2CZUL0 newFuUdWtJ+Mq4w/akWYyZ9l5HPyHLKly14S9yo101ISmVUrFMJ79/AqKr0JK3pcqlCaD7p1b XSjX/FROTF8tNuFqJ99jgANAlqYduVvKW9ThTe2oDhWM+eovWSKOpAKUYplt3A07bjQUC0wtE qdx52fypuOJlMM+/CWACvlXko05OaLcgsXQQtwPTMVf1LryDyTkMfDsQXO/h+ype2AHV4OgBY 28zveKyFXZHV/IRTE3i3KV9wa4d0izNAchNtFT7il0TpJwGniK9465jDek7nJQ0b/KnjlaZGN +WVRpKtcfXlP5G6un7ua/CPBzO4mRYoK/PEE6VlAVfgOqbEyJfkeXkmDPnqDu8qvOgE6+xVqE hHNJArqpw/yYGbeUcEhDdZekLlsICUmwkMg7+Z4a+7tBnjZeHpBAHDuaYF5djn4WOsHJ72Lrc QIzMr6wlIYCihvtXk1ILvEFTo0S3GzoOvuhPZzBhCuYqccfYTeYTdzsQEAYcGtElo0a9U2EPb eFd+tvd Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Wed, 26 Apr 2017 16:45:25 +0200 A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "devm_kcalloc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Reviewed-by: Keerthy --- drivers/thermal/ti-soc-thermal/ti-bandgap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index ba9c302454fb..f19cb7612a65 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c @@ -1224,8 +1224,8 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev) bgp->conf = of_id->data; /* register shadow for context save and restore */ - bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) * - bgp->conf->sensor_count, GFP_KERNEL); + bgp->regval = devm_kcalloc(&pdev->dev, bgp->conf->sensor_count, + sizeof(*bgp->regval), GFP_KERNEL); if (!bgp->regval) { dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n"); return ERR_PTR(-ENOMEM);