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>
This commit is contained in:
parent
16786454ac
commit
a1edf9cf6d
|
@ -3546,10 +3546,12 @@ EXPORT_SYMBOL(transport_kmap_data_sg);
|
||||||
|
|
||||||
void transport_kunmap_data_sg(struct se_cmd *cmd)
|
void transport_kunmap_data_sg(struct se_cmd *cmd)
|
||||||
{
|
{
|
||||||
if (!cmd->t_data_nents)
|
if (!cmd->t_data_nents) {
|
||||||
return;
|
return;
|
||||||
else if (cmd->t_data_nents == 1)
|
} else if (cmd->t_data_nents == 1) {
|
||||||
kunmap(sg_page(cmd->t_data_sg));
|
kunmap(sg_page(cmd->t_data_sg));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
vunmap(cmd->t_data_vmap);
|
vunmap(cmd->t_data_vmap);
|
||||||
cmd->t_data_vmap = NULL;
|
cmd->t_data_vmap = NULL;
|
||||||
|
|
Reference in New Issue