mmcsd_sdio:Insure a error exiting via mmcsd_removed will not Hang system.

mmcsd_removed will be called if the card is in invalid state.
   This can happen if the card is bad, or vibrations causes a power
   loss.

   mmcsd_removed resets:
     priv->capacity     = 0; /* Capacity=0 sometimes means no media */
     priv->blocksize    = 0;
     priv->probed       = false;
     priv->mediachanged = false;
     priv->wrbusy       = false;
     priv->type         = MMCSD_CARDTYPE_UNKNOWN;
     priv->rca          = 0;
     priv->selblocklen  = 0;
     priv->widebus      = false;

  If blocksize is set to 0 will cause the log2 to result
  in an infinate loop in some drivers.

  IS_EMPTY will check for priv->type = MMCSD_CARDTYPE_UNKNOWN
  and return ENODEV.
This commit is contained in:
David Sidrane 2023-02-09 11:31:38 -08:00 committed by Xiang Xiao
parent 33b22f51da
commit d570a93945
1 changed files with 1 additions and 1 deletions

View File

@ -1190,7 +1190,7 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
/* First, check if the card has been removed. */
if (!SDIO_PRESENT(priv->dev))
if (IS_EMPTY(priv) || !SDIO_PRESENT(priv->dev))
{
ferr("ERROR: Card has been removed\n");
return -ENODEV;