updating the placement of error detection based on testing
authorPotluri Krishna <x1082264@ti.com>
Wed, 20 Oct 2021 17:09:55 +0000 (22:39 +0530)
committerAnkur <ankurbaranwal@ti.com>
Wed, 27 Oct 2021 08:38:35 +0000 (03:38 -0500)
packages/ti/drv/mmcsd/src/v2/MMCSD_v2.c

index a01540fcde0d9a69e68e8a77ee4d5529355552a2..f7e123d28b3d4eabc7d58c08072cdfb15329113e 100755 (executable)
@@ -2752,7 +2752,6 @@ static MMCSD_Error MMCSD_v2_transfer(MMCSD_Handle handle,
     MMCSD_v2_Object        *object = NULL;
     MMCSD_v2_HwAttrs const *hwAttrs = NULL;
     uint32_t params;
-       volatile uint32_t        status = 0U;
 
     if ((handle != NULL) && (transaction != NULL))
     {
@@ -3233,37 +3232,36 @@ cmdObj.cmd.xferType = (transaction->flags & MMCSD_CMDRSP_READ) ? \
 #endif
             }
 
+            /* Get response for command sent to MMC device */
+            HSMMCSDResponseGet(hwAttrs->baseAddr, transaction->response);
+
+            /* Release the lock for this particular MMCSD handle */
+            MMCSD_osalPostLock(object->commandMutex);
+        }
+
         /* Data transfer fail or  Command execution fail */
         if ((1 == object->xferTimeout) || (1 == object->cmdTimeout))
         {
             if (1 == object->xferTimeout)
             {
                 ret = MMCSD_ERR;
-                 object->xferTimeout = 0;
+                object->xferTimeout = 0;
 #ifdef LOG_EN
-                 MMCSD_drv_log4(Diags_USER1,
-                         "MMCSD:(%p) Data Transfer Failed", hwAttrs->baseAddr);
+                MMCSD_drv_log4(Diags_USER1,
+                     "MMCSD:(%p) Data Transfer Failed", hwAttrs->baseAddr);
 #endif
             }
             else
             {
-               ret = MMCSD_ERR;
+                ret = MMCSD_ERR;
                 object->cmdTimeout = 0;
 #ifdef LOG_EN
                 MMCSD_drv_log4(Diags_USER1,
-                        "MMCSD:(%p) Command Execution Failed", hwAttrs->baseAddr);
+                    "MMCSD:(%p) Command Execution Failed", hwAttrs->baseAddr);
 #endif
             }
-                MMCSD_v2_controllerReset(object, (MMCSD_v2_HwAttrs *)hwAttrs);
-        }
-
-            /* Git response for command sent to MMC device */
-            HSMMCSDResponseGet(hwAttrs->baseAddr, transaction->response);
-
-            /* Release the lock for this particular MMCSD handle */
-            MMCSD_osalPostLock(object->commandMutex);
+            MMCSD_v2_controllerReset(object, (MMCSD_v2_HwAttrs *)hwAttrs);
         }
-    
     }
     /* Return the transaction status */
     return (ret);