Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932291AbdDZRw5 (ORCPT ); Wed, 26 Apr 2017 13:52:57 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:41606 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753755AbdDZRww (ORCPT ); Wed, 26 Apr 2017 13:52:52 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 26 Apr 2017 10:52:50 -0700 From: Subhash Jadavani To: SF Markus Elfring Cc: linux-scsi@vger.kernel.org, "James E. J. Bottomley" , "Martin K. Petersen" , Vinayak Holikatti , LKML , kernel-janitors@vger.kernel.org, linux-scsi-owner@vger.kernel.org Subject: Re: [PATCH 1/3] scsi: ufs: Use devm_kcalloc() in ufshcd_memory_alloc() In-Reply-To: References: <75622f45-f46c-e52f-2b9e-6ff5ce32184a@users.sourceforge.net> Message-ID: <4238f38b6990c86b239d30c794ed48b6@codeaurora.org> User-Agent: Roundcube Webmail/1.2.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1456 Lines: 40 On 2017-04-25 13:26, SF Markus Elfring wrote: > From: Markus Elfring > Date: Tue, 25 Apr 2017 21: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". > > * Replace the specification of a data structure by a pointer > dereference > to make the corresponding size determination a bit safer according to > the Linux coding style convention. > > Signed-off-by: Markus Elfring > --- > drivers/scsi/ufs/ufshcd.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index 9ef8ce7f01a2..ce385911a20e 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -3270,8 +3270,7 @@ static int ufshcd_memory_alloc(struct ufs_hba > *hba) > } > > /* Allocate memory for local reference block */ > - hba->lrb = devm_kzalloc(hba->dev, > - hba->nutrs * sizeof(struct ufshcd_lrb), > + hba->lrb = devm_kcalloc(hba->dev, hba->nutrs, sizeof(*hba->lrb), > GFP_KERNEL); > if (!hba->lrb) { > dev_err(hba->dev, "LRB Memory allocation failed\n"); Looks good to me. Reviewed-by: Subhash Jadavani -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project