drivers/mmcsd/mmcsd_sdio.c: Enter a removed card state On a failure. If we fail to read cardstatus in mmcsd_transferready consider this a hard error and set the card to removed.

This commit is contained in:
David Sidrane 2019-10-29 10:05:10 -06:00 committed by Gregory Nutt
parent b7073a366b
commit 5f65012449

View File

@ -1252,7 +1252,7 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
if (ret != OK)
{
ferr("ERROR: mmcsd_getR1 failed: %d\n", ret);
return ret;
goto errorout;
}
/* Now check if the card is in the expected transfer state. */
@ -1282,7 +1282,8 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
*/
ferr("ERROR: Unexpected R1 state: %08x\n", r1);
return -EINVAL;
ret = -EINVAL;
goto errorout;
}
/* We are still in the programming state. Calculate the elapsed
@ -1294,6 +1295,10 @@ static int mmcsd_transferready(FAR struct mmcsd_state_s *priv)
while (elapsed < TICK_PER_SEC);
return -ETIMEDOUT;
errorout:
mmcsd_removed(priv);
return ret;
}
/****************************************************************************