Skip to content

Commit

Permalink
target: Remove extra percpu_ref_init
Browse files Browse the repository at this point in the history
lun->lun_ref is also initialized in core_tpg_post_addlun, so it doesn't
need to be done in core_tpg_setup_virtual_lun0.

(nab: Drop left-over percpu_ref_cancel_init in failure path)

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Andy Grover authored and Nicholas Bellinger committed Dec 19, 2013
1 parent 95cadac commit de06875
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions drivers/target/target_core_tpg.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,15 +656,9 @@ static int core_tpg_setup_virtual_lun0(struct se_portal_group *se_tpg)
spin_lock_init(&lun->lun_sep_lock);
init_completion(&lun->lun_ref_comp);

ret = percpu_ref_init(&lun->lun_ref, core_tpg_lun_ref_release);
if (ret < 0)
return ret;

ret = core_tpg_post_addlun(se_tpg, lun, lun_access, dev);
if (ret < 0) {
percpu_ref_cancel_init(&lun->lun_ref);
if (ret < 0)
return ret;
}

return 0;
}
Expand Down

0 comments on commit de06875

Please sign in to comment.