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>
This commit is contained in:
Bart Van Assche 2018-11-27 15:51:56 -08:00 коммит произвёл Martin K. Petersen
Родитель e7f411049f
Коммит 5d6cd9fe31
1 изменённых файлов: 4 добавлений и 7 удалений

Просмотреть файл

@ -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,