diff options
author | Roland Dreier <roland@purestorage.com> | 2012-11-16 08:06:18 -0800 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-11-27 22:49:18 -0800 |
commit | d9ed69473a345d69cf15831e8db22f159b13cdd2 (patch) | |
tree | 57b5dce87052c09a256242b2b56d66d603eca6fe /drivers/target | |
parent | 06e97b489006f28e23bb028febfa1c01c266d676 (diff) |
target: Clean up logic in transport_put_cmd()
No need to have a goto where a return is clearer.
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_transport.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 4b062c81727..7e7fa58b56e 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -1966,9 +1966,10 @@ static void transport_put_cmd(struct se_cmd *cmd) unsigned long flags; spin_lock_irqsave(&cmd->t_state_lock, flags); - if (atomic_read(&cmd->t_fe_count)) { - if (!atomic_dec_and_test(&cmd->t_fe_count)) - goto out_busy; + if (atomic_read(&cmd->t_fe_count) && + !atomic_dec_and_test(&cmd->t_fe_count)) { + spin_unlock_irqrestore(&cmd->t_state_lock, flags); + return; } if (cmd->transport_state & CMD_T_DEV_ACTIVE) { @@ -1980,8 +1981,6 @@ static void transport_put_cmd(struct se_cmd *cmd) transport_free_pages(cmd); transport_release_cmd(cmd); return; -out_busy: - spin_unlock_irqrestore(&cmd->t_state_lock, flags); } void *transport_kmap_data_sg(struct se_cmd *cmd) |