linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: fnic: Use vzalloc()
@ 2023-05-27 18:06 Christophe JAILLET
  2023-06-01  0:08 ` Martin K. Petersen
  2023-06-08  1:42 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2023-05-27 18:06 UTC (permalink / raw)
  To: Satish Kharat, Sesidhar Baddela, Karan Tilak Kumar,
	James E.J. Bottomley, Martin K. Petersen
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-scsi

Use vzalloc() instead of hand writing it with vmalloc()+memset().
This is less verbose.

This also fixes some style issues :)

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/scsi/fnic/fnic_debugfs.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
index 6fedc3b7d1ab..c4d9ed0d7d75 100644
--- a/drivers/scsi/fnic/fnic_debugfs.c
+++ b/drivers/scsi/fnic/fnic_debugfs.c
@@ -201,25 +201,21 @@ static int fnic_trace_debugfs_open(struct inode *inode,
 		return -ENOMEM;
 
 	if (*rdata_ptr == fc_trc_flag->fnic_trace) {
-		fnic_dbg_prt->buffer = vmalloc(array3_size(3, trace_max_pages,
+		fnic_dbg_prt->buffer = vzalloc(array3_size(3, trace_max_pages,
 							   PAGE_SIZE));
 		if (!fnic_dbg_prt->buffer) {
 			kfree(fnic_dbg_prt);
 			return -ENOMEM;
 		}
-		memset((void *)fnic_dbg_prt->buffer, 0,
-		3 * (trace_max_pages * PAGE_SIZE));
 		fnic_dbg_prt->buffer_len = fnic_get_trace_data(fnic_dbg_prt);
 	} else {
 		fnic_dbg_prt->buffer =
-			vmalloc(array3_size(3, fnic_fc_trace_max_pages,
+			vzalloc(array3_size(3, fnic_fc_trace_max_pages,
 					    PAGE_SIZE));
 		if (!fnic_dbg_prt->buffer) {
 			kfree(fnic_dbg_prt);
 			return -ENOMEM;
 		}
-		memset((void *)fnic_dbg_prt->buffer, 0,
-			3 * (fnic_fc_trace_max_pages * PAGE_SIZE));
 		fnic_dbg_prt->buffer_len =
 			fnic_fc_trace_get_data(fnic_dbg_prt, *rdata_ptr);
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: fnic: Use vzalloc()
  2023-05-27 18:06 [PATCH] scsi: fnic: Use vzalloc() Christophe JAILLET
@ 2023-06-01  0:08 ` Martin K. Petersen
  2023-06-08  1:42 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2023-06-01  0:08 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Satish Kharat, Sesidhar Baddela, Karan Tilak Kumar,
	James E.J. Bottomley, Martin K. Petersen, linux-kernel,
	kernel-janitors, linux-scsi


Christophe,

> Use vzalloc() instead of hand writing it with vmalloc()+memset().
> This is less verbose.

Applied to 6.5/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: fnic: Use vzalloc()
  2023-05-27 18:06 [PATCH] scsi: fnic: Use vzalloc() Christophe JAILLET
  2023-06-01  0:08 ` Martin K. Petersen
@ 2023-06-08  1:42 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2023-06-08  1:42 UTC (permalink / raw)
  To: Satish Kharat, Sesidhar Baddela, Karan Tilak Kumar,
	James E.J. Bottomley, Christophe JAILLET
  Cc: Martin K . Petersen, linux-kernel, kernel-janitors, linux-scsi

On Sat, 27 May 2023 20:06:37 +0200, Christophe JAILLET wrote:

> Use vzalloc() instead of hand writing it with vmalloc()+memset().
> This is less verbose.
> 
> This also fixes some style issues :)
> 
> 

Applied to 6.5/scsi-queue, thanks!

[1/1] scsi: fnic: Use vzalloc()
      https://git.kernel.org/mkp/scsi/c/14ce2c261d6c

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-08  1:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-27 18:06 [PATCH] scsi: fnic: Use vzalloc() Christophe JAILLET
2023-06-01  0:08 ` Martin K. Petersen
2023-06-08  1:42 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).