Merge branch 'topic/azt3328' into for-linus
[pandora-kernel.git] / drivers / ata / libata-eh.c
index fa22f94..79711b6 100644 (file)
@@ -2327,7 +2327,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
        struct ata_port *ap = link->ap;
        struct ata_link *slave = ap->slave_link;
        struct ata_eh_context *ehc = &link->eh_context;
-       struct ata_eh_context *sehc = &slave->eh_context;
+       struct ata_eh_context *sehc = slave ? &slave->eh_context : NULL;
        unsigned int *classes = ehc->classes;
        unsigned int lflags = link->flags;
        int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
@@ -2517,6 +2517,10 @@ int ata_eh_reset(struct ata_link *link, int classify,
 
                        ata_eh_about_to_do(link, NULL, ATA_EH_RESET);
                        rc = ata_do_reset(link, reset, classes, deadline, true);
+                       if (rc) {
+                               failed_link = link;
+                               goto fail;
+                       }
                }
        } else {
                if (verbose)