* [PATCH] scsi: storvsc: Prefer kcalloc over kzalloc with multiply
@ 2017-03-16 6:58 Miguel Bernal Marin
2017-04-13 23:27 ` KY Srinivasan
0 siblings, 1 reply; 2+ messages in thread
From: Miguel Bernal Marin @ 2017-03-16 6:58 UTC (permalink / raw)
To: K. Y. Srinivasan, Martin K. Petersen
Cc: linux-kernel, linux-scsi, devel, Haiyang Zhang,
Stephen Hemminger, James E.J. Bottomley
Use kcalloc for allocating an array instead of kzalloc with multiply,
kcalloc is the preferred API.
Found with checkpatch.
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
---
drivers/scsi/storvsc_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 638e5f427c90..3d70d1cf49a3 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -866,7 +866,7 @@ static int storvsc_channel_init(struct hv_device *device, bool is_fc)
* We will however populate all the slots to evenly distribute
* the load.
*/
- stor_device->stor_chns = kzalloc(sizeof(void *) * num_possible_cpus(),
+ stor_device->stor_chns = kcalloc(num_possible_cpus(), sizeof(void *),
GFP_KERNEL);
if (stor_device->stor_chns == NULL)
return -ENOMEM;
--
2.12.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] scsi: storvsc: Prefer kcalloc over kzalloc with multiply
2017-03-16 6:58 [PATCH] scsi: storvsc: Prefer kcalloc over kzalloc with multiply Miguel Bernal Marin
@ 2017-04-13 23:27 ` KY Srinivasan
0 siblings, 0 replies; 2+ messages in thread
From: KY Srinivasan @ 2017-04-13 23:27 UTC (permalink / raw)
To: Miguel Bernal Marin, Martin K. Petersen
Cc: linux-kernel, linux-scsi, devel, Haiyang Zhang,
Stephen Hemminger, James E.J. Bottomley
> -----Original Message-----
> From: Miguel Bernal Marin [mailto:miguel.bernal.marin@linux.intel.com]
> Sent: Wednesday, March 15, 2017 11:58 PM
> To: KY Srinivasan <kys@microsoft.com>; Martin K. Petersen
> <martin.petersen@oracle.com>
> Cc: linux-kernel@vger.kernel.org; linux-scsi@vger.kernel.org;
> devel@linuxdriverproject.org; Haiyang Zhang <haiyangz@microsoft.com>;
> Stephen Hemminger <sthemmin@microsoft.com>; James E.J. Bottomley
> <jejb@linux.vnet.ibm.com>
> Subject: [PATCH] scsi: storvsc: Prefer kcalloc over kzalloc with multiply
>
> Use kcalloc for allocating an array instead of kzalloc with multiply,
> kcalloc is the preferred API.
>
> Found with checkpatch.
>
> Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
> drivers/scsi/storvsc_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
> index 638e5f427c90..3d70d1cf49a3 100644
> --- a/drivers/scsi/storvsc_drv.c
> +++ b/drivers/scsi/storvsc_drv.c
> @@ -866,7 +866,7 @@ static int storvsc_channel_init(struct hv_device
> *device, bool is_fc)
> * We will however populate all the slots to evenly distribute
> * the load.
> */
> - stor_device->stor_chns = kzalloc(sizeof(void *) *
> num_possible_cpus(),
> + stor_device->stor_chns = kcalloc(num_possible_cpus(), sizeof(void
> *),
> GFP_KERNEL);
> if (stor_device->stor_chns == NULL)
> return -ENOMEM;
> --
> 2.12.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-13 23:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-16 6:58 [PATCH] scsi: storvsc: Prefer kcalloc over kzalloc with multiply Miguel Bernal Marin
2017-04-13 23:27 ` KY Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®