drivers/mmcsd/mmcsd_sdio.c: Set wrbusy after success of all the operations. Any failure could leave wrbusy set when it should not be if the operation failed.

This commit is contained in:
David Sidrane 2019-10-29 10:03:18 -06:00 committed by Gregory Nutt
parent a0f46118f6
commit b7073a366b

View File

@ -1823,12 +1823,6 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
SDIO_SENDSETUP(priv->dev, buffer, priv->blocksize);
}
/* Flag that a write transfer is pending that we will have to check for
* write complete at the beginning of the next transfer.
*/
priv->wrbusy = true;
/* If Controller needs DMA setup before write then only send CMD24 now. */
if ((priv->caps & SDIO_CAPS_DMABEFOREWRITE) != 0)
@ -1854,6 +1848,12 @@ static ssize_t mmcsd_writesingle(FAR struct mmcsd_state_s *priv,
return ret;
}
/* Flag that a write transfer is pending that we will have to check for
* write complete at the beginning of the next transfer.
*/
priv->wrbusy = true;
#if defined(CONFIG_MMCSD_SDIOWAIT_WRCOMPLETE)
/* Arm the write complete detection with timeout */
@ -2026,12 +2026,6 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
SDIO_SENDSETUP(priv->dev, buffer, nbytes);
}
/* Flag that a write transfer is pending that we will have to check for
* write complete at the beginning of the next transfer.
*/
priv->wrbusy = true;
/* If Controller needs DMA setup before write then only send CMD25 now. */
if ((priv->caps & SDIO_CAPS_DMABEFOREWRITE) != 0)
@ -2078,6 +2072,12 @@ static ssize_t mmcsd_writemultiple(FAR struct mmcsd_state_s *priv,
return ret;
}
/* Flag that a write transfer is pending that we will have to check for
* write complete at the beginning of the next transfer.
*/
priv->wrbusy = true;
/* On success, return the number of blocks written */
return nblocks;
@ -3493,9 +3493,10 @@ static int mmcsd_removed(FAR struct mmcsd_state_s *priv)
priv->capacity = 0; /* Capacity=0 sometimes means no media */
priv->blocksize = 0;
priv->mediachanged = false;
priv->type = MMCSD_CARDTYPE_UNKNOWN;
priv->probed = false;
priv->mediachanged = false;
priv->wrbusy = false;
priv->type = MMCSD_CARDTYPE_UNKNOWN;
priv->rca = 0;
priv->selblocklen = 0;