hw/pvrdma: Check the correct return value
Return value of 0 means ok, we want to free the memory only in case of error. Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com> Message-Id: <20181025061700.17050-1-yuval.shaia@oracle.com> Reviewed-by: Marcel Apfelbaum<marcel.apfelbaum@gmail.com> Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
This commit is contained in:
parent
891ff9f4a3
commit
dee2e53c86
|
@ -232,7 +232,7 @@ static int create_mr(PVRDMADev *dev, union pvrdma_cmd_req *req,
|
||||||
cmd->start, cmd->length, host_virt,
|
cmd->start, cmd->length, host_virt,
|
||||||
cmd->access_flags, &resp->mr_handle,
|
cmd->access_flags, &resp->mr_handle,
|
||||||
&resp->lkey, &resp->rkey);
|
&resp->lkey, &resp->rkey);
|
||||||
if (host_virt && !resp->hdr.err) {
|
if (resp->hdr.err && host_virt) {
|
||||||
munmap(host_virt, cmd->length);
|
munmap(host_virt, cmd->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue