]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/scsi/aic94xx/aic94xx_tmf.c
[SCSI] libsas: fix sas_find_local_phy(), take phy references
[mv-sheeva.git] / drivers / scsi / aic94xx / aic94xx_tmf.c
index 0add73bdf2a4f6f98d34379c9999b91313026a03..50b914ffab9440d20d3844ea631733535265b202 100644 (file)
@@ -181,7 +181,7 @@ static int asd_clear_nexus_I_T(struct domain_device *dev,
 int asd_I_T_nexus_reset(struct domain_device *dev)
 {
        int res, tmp_res, i;
-       struct sas_phy *phy = sas_find_local_phy(dev);
+       struct sas_phy *phy = sas_get_local_phy(dev);
        /* Standard mandates link reset for ATA  (type 0) and
         * hard reset for SSP (type 1) */
        int reset_type = (dev->dev_type == SATA_DEV ||
@@ -201,7 +201,7 @@ int asd_I_T_nexus_reset(struct domain_device *dev)
        for (i = 0 ; i < 3; i++) {
                tmp_res = asd_clear_nexus_I_T(dev, NEXUS_PHASE_RESUME);
                if (tmp_res == TC_RESUME)
-                       return res;
+                       goto out;
                msleep(500);
        }
 
@@ -211,7 +211,10 @@ int asd_I_T_nexus_reset(struct domain_device *dev)
        dev_printk(KERN_ERR, &phy->dev,
                   "Failed to resume nexus after reset 0x%x\n", tmp_res);
 
-       return TMF_RESP_FUNC_FAILED;
+       res = TMF_RESP_FUNC_FAILED;
+ out:
+       sas_put_local_phy(phy);
+       return res;
 }
 
 static int asd_clear_nexus_I_T_L(struct domain_device *dev, u8 *lun)