Skip to content

Commit

Permalink
scsi: target/core: Use kvcalloc() instead of open-coding it
Browse files Browse the repository at this point in the history
This patch does not change any functionality. Note: the code that frees
sess_cmd_map already uses kvfree() so that code does not need to be
modified.

Reviewed-by: David Disseldorp <[email protected]>
Cc: Nicholas Bellinger <[email protected]>
Cc: Mike Christie <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Signed-off-by: Bart Van Assche <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
bvanassche authored and martinkpetersen committed Dec 8, 2018
1 parent e7f4110 commit 5d6cd9f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,11 @@ int transport_alloc_session_tags(struct se_session *se_sess,
{
int rc;

se_sess->sess_cmd_map = kcalloc(tag_size, tag_num,
GFP_KERNEL | __GFP_NOWARN | __GFP_RETRY_MAYFAIL);
se_sess->sess_cmd_map = kvcalloc(tag_size, tag_num,
GFP_KERNEL | __GFP_RETRY_MAYFAIL);
if (!se_sess->sess_cmd_map) {
se_sess->sess_cmd_map = vzalloc(array_size(tag_size, tag_num));
if (!se_sess->sess_cmd_map) {
pr_err("Unable to allocate se_sess->sess_cmd_map\n");
return -ENOMEM;
}
pr_err("Unable to allocate se_sess->sess_cmd_map\n");
return -ENOMEM;
}

rc = sbitmap_queue_init_node(&se_sess->sess_tag_pool, tag_num, -1,
Expand Down

0 comments on commit 5d6cd9f

Please sign in to comment.