Commit 14ce2c26 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Martin K. Petersen

scsi: fnic: Use vzalloc()

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

This also fixes some style issues :)
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/a1179941a6d440140513e681f4f3a1b92c8d83ae.1685210773.git.christophe.jaillet@wanadoo.frSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 4851c39a
...@@ -201,25 +201,21 @@ static int fnic_trace_debugfs_open(struct inode *inode, ...@@ -201,25 +201,21 @@ static int fnic_trace_debugfs_open(struct inode *inode,
return -ENOMEM; return -ENOMEM;
if (*rdata_ptr == fc_trc_flag->fnic_trace) { 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)); PAGE_SIZE));
if (!fnic_dbg_prt->buffer) { if (!fnic_dbg_prt->buffer) {
kfree(fnic_dbg_prt); kfree(fnic_dbg_prt);
return -ENOMEM; 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); fnic_dbg_prt->buffer_len = fnic_get_trace_data(fnic_dbg_prt);
} else { } else {
fnic_dbg_prt->buffer = fnic_dbg_prt->buffer =
vmalloc(array3_size(3, fnic_fc_trace_max_pages, vzalloc(array3_size(3, fnic_fc_trace_max_pages,
PAGE_SIZE)); PAGE_SIZE));
if (!fnic_dbg_prt->buffer) { if (!fnic_dbg_prt->buffer) {
kfree(fnic_dbg_prt); kfree(fnic_dbg_prt);
return -ENOMEM; return -ENOMEM;
} }
memset((void *)fnic_dbg_prt->buffer, 0,
3 * (fnic_fc_trace_max_pages * PAGE_SIZE));
fnic_dbg_prt->buffer_len = fnic_dbg_prt->buffer_len =
fnic_fc_trace_get_data(fnic_dbg_prt, *rdata_ptr); fnic_fc_trace_get_data(fnic_dbg_prt, *rdata_ptr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment