diff options
author | Bart Van Assche <bvanassche@acm.org> | 2018-11-27 15:51:56 -0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-12-07 21:20:07 -0500 |
commit | 5d6cd9fe318b4a6ed2ecee83306db3f543a4f9c4 (patch) | |
tree | 8a46441073a3bff0f4aea659a39f6d6372ae8404 /drivers/target/target_core_transport.c | |
parent | e7f411049f5164ee6db6c3434c07302846f09990 (diff) | |
download | linux-stable-5d6cd9fe318b4a6ed2ecee83306db3f543a4f9c4.tar.gz linux-stable-5d6cd9fe318b4a6ed2ecee83306db3f543a4f9c4.tar.bz2 linux-stable-5d6cd9fe318b4a6ed2ecee83306db3f543a4f9c4.zip |
scsi: target/core: Use kvcalloc() instead of open-coding it
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 <ddiss@suse.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Mike Christie <mchristi@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/target/target_core_transport.c')
-rw-r--r-- | drivers/target/target_core_transport.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 50785cfd79ef..4d1651e46ea9 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -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, |