diff options
author | David S. Miller <davem@davemloft.net> | 2012-05-16 22:17:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-16 22:17:37 -0400 |
commit | 028940342a906db8da014a7603a0deddc2c323dd (patch) | |
tree | 688dbc38a3e218f2493d311b1d70a67668837347 /drivers/scsi/virtio_scsi.c | |
parent | be3eed2e96340d3c7a4d1ea1d63e7bd6095d1e34 (diff) | |
parent | 0e93b4b304ae052ba1bc73f6d34a68556fe93429 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'drivers/scsi/virtio_scsi.c')
-rw-r--r-- | drivers/scsi/virtio_scsi.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index efccd72c4a3e..1b3843117268 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -175,7 +175,8 @@ static void virtscsi_complete_free(void *buf) | |||
175 | 175 | ||
176 | if (cmd->comp) | 176 | if (cmd->comp) |
177 | complete_all(cmd->comp); | 177 | complete_all(cmd->comp); |
178 | mempool_free(cmd, virtscsi_cmd_pool); | 178 | else |
179 | mempool_free(cmd, virtscsi_cmd_pool); | ||
179 | } | 180 | } |
180 | 181 | ||
181 | static void virtscsi_ctrl_done(struct virtqueue *vq) | 182 | static void virtscsi_ctrl_done(struct virtqueue *vq) |
@@ -311,21 +312,22 @@ out: | |||
311 | static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd) | 312 | static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd) |
312 | { | 313 | { |
313 | DECLARE_COMPLETION_ONSTACK(comp); | 314 | DECLARE_COMPLETION_ONSTACK(comp); |
314 | int ret; | 315 | int ret = FAILED; |
315 | 316 | ||
316 | cmd->comp = ∁ | 317 | cmd->comp = ∁ |
317 | ret = virtscsi_kick_cmd(vscsi, vscsi->ctrl_vq, cmd, | 318 | if (virtscsi_kick_cmd(vscsi, vscsi->ctrl_vq, cmd, |
318 | sizeof cmd->req.tmf, sizeof cmd->resp.tmf, | 319 | sizeof cmd->req.tmf, sizeof cmd->resp.tmf, |
319 | GFP_NOIO); | 320 | GFP_NOIO) < 0) |
320 | if (ret < 0) | 321 | goto out; |
321 | return FAILED; | ||
322 | 322 | ||
323 | wait_for_completion(&comp); | 323 | wait_for_completion(&comp); |
324 | if (cmd->resp.tmf.response != VIRTIO_SCSI_S_OK && | 324 | if (cmd->resp.tmf.response == VIRTIO_SCSI_S_OK || |
325 | cmd->resp.tmf.response != VIRTIO_SCSI_S_FUNCTION_SUCCEEDED) | 325 | cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED) |
326 | return FAILED; | 326 | ret = SUCCESS; |
327 | 327 | ||
328 | return SUCCESS; | 328 | out: |
329 | mempool_free(cmd, virtscsi_cmd_pool); | ||
330 | return ret; | ||
329 | } | 331 | } |
330 | 332 | ||
331 | static int virtscsi_device_reset(struct scsi_cmnd *sc) | 333 | static int virtscsi_device_reset(struct scsi_cmnd *sc) |