aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2012-02-09 15:18:06 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2012-02-25 17:37:48 -0500
commita1edf9cf6d1efed2981fcf6e4caa704fbb1bd093 (patch)
treee9b0c6585a2028844d790efae0bf3ca15e4276cf
parent16786454acec0e0e55e32d508b3058b32c1f23f3 (diff)
target: Cleanup transport_kunmap_data_sg()
This code isn't broken per se, but it's scary to look at! It looks like in the t_data_nents==1 case we're doing both a kunmap and a vunmap, what's saving us is that t_data_vmap in this case is 0, so vunmap doesn't do anything. Return after kunmap, so the handling of the three cases does not overlap. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_transport.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 42da7a300729..1520dd2dd718 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -3546,10 +3546,12 @@ EXPORT_SYMBOL(transport_kmap_data_sg);
3546 3546
3547void transport_kunmap_data_sg(struct se_cmd *cmd) 3547void transport_kunmap_data_sg(struct se_cmd *cmd)
3548{ 3548{
3549 if (!cmd->t_data_nents) 3549 if (!cmd->t_data_nents) {
3550 return; 3550 return;
3551 else if (cmd->t_data_nents == 1) 3551 } else if (cmd->t_data_nents == 1) {
3552 kunmap(sg_page(cmd->t_data_sg)); 3552 kunmap(sg_page(cmd->t_data_sg));
3553 return;
3554 }
3553 3555
3554 vunmap(cmd->t_data_vmap); 3556 vunmap(cmd->t_data_vmap);
3555 cmd->t_data_vmap = NULL; 3557 cmd->t_data_vmap = NULL;