Commit de64d3a6 authored by Pekka Enberg's avatar Pekka Enberg Committed by Linus Torvalds

target: use kvfree() in session alloc and free

Use kvfree() instead of open-coding it.
Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f8c5b939
...@@ -279,10 +279,7 @@ int transport_alloc_session_tags(struct se_session *se_sess, ...@@ -279,10 +279,7 @@ int transport_alloc_session_tags(struct se_session *se_sess,
if (rc < 0) { if (rc < 0) {
pr_err("Unable to init se_sess->sess_tag_pool," pr_err("Unable to init se_sess->sess_tag_pool,"
" tag_num: %u\n", tag_num); " tag_num: %u\n", tag_num);
if (is_vmalloc_addr(se_sess->sess_cmd_map)) kvfree(se_sess->sess_cmd_map);
vfree(se_sess->sess_cmd_map);
else
kfree(se_sess->sess_cmd_map);
se_sess->sess_cmd_map = NULL; se_sess->sess_cmd_map = NULL;
return -ENOMEM; return -ENOMEM;
} }
...@@ -489,10 +486,7 @@ void transport_free_session(struct se_session *se_sess) ...@@ -489,10 +486,7 @@ void transport_free_session(struct se_session *se_sess)
{ {
if (se_sess->sess_cmd_map) { if (se_sess->sess_cmd_map) {
percpu_ida_destroy(&se_sess->sess_tag_pool); percpu_ida_destroy(&se_sess->sess_tag_pool);
if (is_vmalloc_addr(se_sess->sess_cmd_map)) kvfree(se_sess->sess_cmd_map);
vfree(se_sess->sess_cmd_map);
else
kfree(se_sess->sess_cmd_map);
} }
kmem_cache_free(se_sess_cache, se_sess); kmem_cache_free(se_sess_cache, se_sess);
} }
......
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