From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754062AbdDOKsw (ORCPT ); Sat, 15 Apr 2017 06:48:52 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35759 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752884AbdDOKst (ORCPT ); Sat, 15 Apr 2017 06:48:49 -0400 Date: Sat, 15 Apr 2017 12:48:45 +0200 From: Krzysztof Kozlowski To: SF Markus Elfring Cc: linux-samsung-soc@vger.kernel.org, Bartlomiej Zolnierkiewicz , Liam Girdwood , Mark Brown , Sangbeom Kim , LKML , kernel-janitors@vger.kernel.org Subject: Re: [PATCH 1/2] regulator: s2mps11: Use kcalloc() in s2mps11_pmic_probe() Message-ID: <20170415104845.bofxl34wr7z7khix@kozik-lap> References: <542252e0-817f-ce13-fbd5-8fd8dda4c746@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <542252e0-817f-ce13-fbd5-8fd8dda4c746@users.sourceforge.net> User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 14, 2017 at 11:01:25PM +0200, SF Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 14 Apr 2017 22:00:35 +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 "kcalloc". > > This issue was detected by using the Coccinelle software. Unfortunately you write mostly cryptic commit messages. This does not answer for the main question - why this change is needed. Code looks okay, but you should explain in simple words why this is needed. Best regards, Krzysztof > > Signed-off-by: Markus Elfring > --- > drivers/regulator/s2mps11.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c > index 7726b874e539..b4e588cce03d 100644 > --- a/drivers/regulator/s2mps11.c > +++ b/drivers/regulator/s2mps11.c > @@ -1162,7 +1162,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) > } > } > > - rdata = kzalloc(sizeof(*rdata) * rdev_num, GFP_KERNEL); > + rdata = kcalloc(rdev_num, sizeof(*rdata), GFP_KERNEL); > if (!rdata) > return -ENOMEM; > > -- > 2.12.2 >