Skip to content

Commit

Permalink
target: use kvfree() in session alloc and free
Browse files Browse the repository at this point in the history
Use kvfree() instead of open-coding it.

Signed-off-by: Pekka Enberg <[email protected]>
Cc: "Nicholas A. Bellinger" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
penberg authored and torvalds committed Jul 1, 2015
1 parent f8c5b93 commit de64d3a
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,7 @@ int transport_alloc_session_tags(struct se_session *se_sess,
if (rc < 0) {
pr_err("Unable to init se_sess->sess_tag_pool,"
" tag_num: %u\n", tag_num);
if (is_vmalloc_addr(se_sess->sess_cmd_map))
vfree(se_sess->sess_cmd_map);
else
kfree(se_sess->sess_cmd_map);
kvfree(se_sess->sess_cmd_map);
se_sess->sess_cmd_map = NULL;
return -ENOMEM;
}
Expand Down Expand Up @@ -489,10 +486,7 @@ void transport_free_session(struct se_session *se_sess)
{
if (se_sess->sess_cmd_map) {
percpu_ida_destroy(&se_sess->sess_tag_pool);
if (is_vmalloc_addr(se_sess->sess_cmd_map))
vfree(se_sess->sess_cmd_map);
else
kfree(se_sess->sess_cmd_map);
kvfree(se_sess->sess_cmd_map);
}
kmem_cache_free(se_sess_cache, se_sess);
}
Expand Down

0 comments on commit de64d3a

Please sign in to comment.