Commit 08475a1920aa7acc535324d6991b830fa7625bd8

Authored by Brian King
Committed by Jeff Garzik
1 parent f33d625f40

[PATCH] libata: Fixup ata_sas_queuecmd to handle __ata_scsi_queuecmd failure

Fixes ata_sas_queuecmd to properly handle a failure from
__ata_scsi_queuecmd.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>

Showing 1 changed file with 6 additions and 3 deletions Side-by-side Diff

drivers/ata/libata-scsi.c
... ... @@ -3347,21 +3347,24 @@
3347 3347 * @ap: ATA port to which the command is being sent
3348 3348 *
3349 3349 * RETURNS:
3350   - * Zero.
  3350 + * Return value from __ata_scsi_queuecmd() if @cmd can be queued,
  3351 + * 0 otherwise.
3351 3352 */
3352 3353  
3353 3354 int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
3354 3355 struct ata_port *ap)
3355 3356 {
  3357 + int rc = 0;
  3358 +
3356 3359 ata_scsi_dump_cdb(ap, cmd);
3357 3360  
3358 3361 if (likely(ata_scsi_dev_enabled(ap->device)))
3359   - __ata_scsi_queuecmd(cmd, done, ap->device);
  3362 + rc = __ata_scsi_queuecmd(cmd, done, ap->device);
3360 3363 else {
3361 3364 cmd->result = (DID_BAD_TARGET << 16);
3362 3365 done(cmd);
3363 3366 }
3364   - return 0;
  3367 + return rc;
3365 3368 }
3366 3369 EXPORT_SYMBOL_GPL(ata_sas_queuecmd);