Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1631633
| From | Subhash Jadavani <subhashj@codeaurora.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/3] scsi: ufs: Use devm_kcalloc() in ufshcd_memory_alloc() |
| Date | 2017-04-26 20:00 +0200 |
| Message-ID | <tAzol-5vz-13@gated-at.bofh.it> (permalink) |
| References | <tAffX-Yq-7@gated-at.bofh.it> <tAffY-Yq-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 2017-04-25 13:26, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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 <elfring@users.sourceforge.net>
> ---
> 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 <subhashj@codeaurora.org>
--
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3] SCSI-UFSHCD: Fine-tuning for two function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-25 22:30 +0200
[PATCH 2/3] scsi: ufs: Delete an error message for a failed memory allocation in ufshcd_memory_alloc() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-25 22:30 +0200
Re: [PATCH 2/3] scsi: ufs: Delete an error message for a failed memory allocation in ufshcd_memory_alloc() Subhash Jadavani <subhashj@codeaurora.org> - 2017-04-26 20:00 +0200
Re: scsi: ufs: Delete an error message for a failed memory allocation in ufshcd_memory_alloc() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-26 20:20 +0200
Re: [PATCH 2/3] scsi: ufs: Delete an error message for a failed memory allocation in ufshcd_memory_alloc() Joe Perches <joe@perches.com> - 2017-04-26 20:30 +0200
Re: Checking error messages for failed memory allocations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-26 21:00 +0200
Re: Checking error messages for failed memory allocations Joe Perches <joe@perches.com> - 2017-04-26 21:10 +0200
Re: Checking error messages for failed memory allocations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-26 21:20 +0200
[PATCH 1/3] scsi: ufs: Use devm_kcalloc() in ufshcd_memory_alloc() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-25 22:30 +0200
Re: [PATCH 1/3] scsi: ufs: Use devm_kcalloc() in ufshcd_memory_alloc() Subhash Jadavani <subhashj@codeaurora.org> - 2017-04-26 20:00 +0200
[PATCH 3/3] scsi: ufs: Delete an unnecessary return statement in ufshcd_exception_event_handler() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-25 22:40 +0200
Re: [PATCH 3/3] scsi: ufs: Delete an unnecessary return statement in ufshcd_exception_event_handler() Subhash Jadavani <subhashj@codeaurora.org> - 2017-04-26 20:10 +0200
csiph-web