target/core: Use kvcalloc() instead of open-coding it
PATCH v2 2/10 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 <[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]>
--- drivers/target/target_core_transport.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/target/target_core_transport.c +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,
Signature · 1 line
2.20.0.rc0.387.gc7a69e6b6c-goog