[PATCH] libata: Fixup ata_sas_queuecmd to handle __ata_scsi_queuecmd failure
authorBrian King <brking@us.ibm.com>
Mon, 20 Nov 2006 19:51:56 +0000 (13:51 -0600)
committerJeff Garzik <jeff@garzik.org>
Tue, 28 Nov 2006 08:51:55 +0000 (03:51 -0500)
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>
drivers/ata/libata-scsi.c

index 22643c0d9a56d46cdd6b547936f3af1b7a88187f..47ea111d5acee837d20d8939b9c52c6a46f0357e 100644 (file)
@@ -3347,20 +3347,23 @@ EXPORT_SYMBOL_GPL(ata_sas_slave_configure);
  *     @ap:    ATA port to which the command is being sent
  *
  *     RETURNS:
- *     Zero.
+ *     Return value from __ata_scsi_queuecmd() if @cmd can be queued,
+ *     0 otherwise.
  */
 
 int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
                     struct ata_port *ap)
 {
+       int rc = 0;
+
        ata_scsi_dump_cdb(ap, cmd);
 
        if (likely(ata_scsi_dev_enabled(ap->device)))
-               __ata_scsi_queuecmd(cmd, done, ap->device);
+               rc = __ata_scsi_queuecmd(cmd, done, ap->device);
        else {
                cmd->result = (DID_BAD_TARGET << 16);
                done(cmd);
        }
-       return 0;
+       return rc;
 }
 EXPORT_SYMBOL_GPL(ata_sas_queuecmd);