From patchwork Tue May 23 07:03:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 9741983 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 1574F60380 for ; Tue, 23 May 2017 07:03:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0415E28784 for ; Tue, 23 May 2017 07:03:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBB3F28796; Tue, 23 May 2017 07:03:12 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 95AFB28784 for ; Tue, 23 May 2017 07:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761524AbdEWHDL (ORCPT ); Tue, 23 May 2017 03:03:11 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:35661 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761481AbdEWHDL (ORCPT ); Tue, 23 May 2017 03:03:11 -0400 Received: by mail-pf0-f181.google.com with SMTP id n23so105416263pfb.2 for ; Tue, 23 May 2017 00:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wp19SMbr5D5eY3iAWEgo9/LUqUuNy2d61/CUaTgDHnc=; b=WSnPyqPjaTu1JkW0E3LnZ4Jcd8sY+cYjuLr3BN1MkGJSIXIALkPOsWuOlfgObXK1ev utSV72augDaLpvm9SmHsrIqJw0etsupmvbxkfSbu18zUhBOqInEGWNBbUkt+B61oQobe spQPW+xIJBtdbQY7G7Fskx19SlZKv4iCJyikw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wp19SMbr5D5eY3iAWEgo9/LUqUuNy2d61/CUaTgDHnc=; b=bP2BC1iUHehZPI+Zraj1FmKAt6tOTiBK62iSMdhZsMde2bljPqTFrYAQfdqZfhtTqi n2rtnDtSYs91rMosTCxSYYT20uQaP6YbXG0d8bcIVfKxoDJ242Q4FxyjjM/WLOrPM7mE Ar7wO8ViSDMSpjd4YVcW/1ghBsXC5eyEWuj7qin0FB7qU19fmYgFLCVp834FF+XRZupu OBu2r8BAvxibG0WHxsXFlbUcoLFam0o/8LSHanhL1bB1Tv6ZCBemwB0lhj62K+905JWC Q7vP5UXXyHquFDdEiKQ6pjrp3/PxznTwSBNyuW1u7wLbjwidf/zjAPCVaSPnrR5EqN5D f1JA== X-Gm-Message-State: AODbwcBYDAqdO3aUcVLJxC1wKSmO5GjTqUDSYgkY5SKlKOJyGWMM5uRE gry7n4n0DxgH1MjP X-Received: by 10.99.109.130 with SMTP id i124mr31049602pgc.117.1495522990351; Tue, 23 May 2017 00:03:10 -0700 (PDT) Received: from localhost ([122.167.143.58]) by smtp.gmail.com with ESMTPSA id f63sm8650219pgc.63.2017.05.23.00.03.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2017 00:03:09 -0700 (PDT) From: Viresh Kumar To: Amit Daniel Kachhap , Viresh Kumar , Javi Merino , Zhang Rui , Eduardo Valentin Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] thermal: cpu_cooling: Replace kmalloc with kmalloc_array Date: Tue, 23 May 2017 12:33:06 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.70.g6367777092d9 In-Reply-To: <1495521460.2303.4.camel@intel.com> References: <1495521460.2303.4.camel@intel.com> 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 Checkpatch reports following: WARNING: Prefer kmalloc_array over kmalloc with multiply + cpufreq_cdev->freq_table = kmalloc(sizeof(*cpufreq_cdev->freq_table) * i, Fix that. Signed-off-by: Viresh Kumar --- drivers/thermal/cpu_cooling.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 1305020790b2..908a8014cf76 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -724,8 +724,9 @@ __cpufreq_cooling_register(struct device_node *np, /* max_level is an index, not a counter */ cpufreq_cdev->max_level = i - 1; - cpufreq_cdev->freq_table = kmalloc(sizeof(*cpufreq_cdev->freq_table) * i, - GFP_KERNEL); + cpufreq_cdev->freq_table = kmalloc_array(i, + sizeof(*cpufreq_cdev->freq_table), + GFP_KERNEL); if (!cpufreq_cdev->freq_table) { cdev = ERR_PTR(-ENOMEM); goto free_idle_time;