Commit 8cce3ecc authored by Shawn Lin's avatar Shawn Lin Committed by Ulf Hansson

mmc: core: remove BUG_ONs from mmc

BUG_ONs doesn't help anything except for stop the system from
running. If it occurs, it implies we should deploy proper error
handling for that. So this patch is gonna discard these meaningless
BUG_ONs and deploy error handling if needed.
Signed-off-by: default avatarShawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent a48ee3e6
...@@ -1486,7 +1486,6 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, ...@@ -1486,7 +1486,6 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
u32 cid[4]; u32 cid[4];
u32 rocr; u32 rocr;
BUG_ON(!host);
WARN_ON(!host->claimed); WARN_ON(!host->claimed);
/* Set correct bus mode for MMC before attempting init */ /* Set correct bus mode for MMC before attempting init */
...@@ -1876,9 +1875,6 @@ static int mmc_poweroff_notify(struct mmc_card *card, unsigned int notify_type) ...@@ -1876,9 +1875,6 @@ static int mmc_poweroff_notify(struct mmc_card *card, unsigned int notify_type)
*/ */
static void mmc_remove(struct mmc_host *host) static void mmc_remove(struct mmc_host *host)
{ {
BUG_ON(!host);
BUG_ON(!host->card);
mmc_remove_card(host->card); mmc_remove_card(host->card);
host->card = NULL; host->card = NULL;
} }
...@@ -1898,9 +1894,6 @@ static void mmc_detect(struct mmc_host *host) ...@@ -1898,9 +1894,6 @@ static void mmc_detect(struct mmc_host *host)
{ {
int err; int err;
BUG_ON(!host);
BUG_ON(!host->card);
mmc_get_card(host->card); mmc_get_card(host->card);
/* /*
...@@ -1926,9 +1919,6 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend) ...@@ -1926,9 +1919,6 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
unsigned int notify_type = is_suspend ? EXT_CSD_POWER_OFF_SHORT : unsigned int notify_type = is_suspend ? EXT_CSD_POWER_OFF_SHORT :
EXT_CSD_POWER_OFF_LONG; EXT_CSD_POWER_OFF_LONG;
BUG_ON(!host);
BUG_ON(!host->card);
mmc_claim_host(host); mmc_claim_host(host);
if (mmc_card_suspended(host->card)) if (mmc_card_suspended(host->card))
...@@ -1985,9 +1975,6 @@ static int _mmc_resume(struct mmc_host *host) ...@@ -1985,9 +1975,6 @@ static int _mmc_resume(struct mmc_host *host)
{ {
int err = 0; int err = 0;
BUG_ON(!host);
BUG_ON(!host->card);
mmc_claim_host(host); mmc_claim_host(host);
if (!mmc_card_suspended(host->card)) if (!mmc_card_suspended(host->card))
...@@ -2120,7 +2107,6 @@ int mmc_attach_mmc(struct mmc_host *host) ...@@ -2120,7 +2107,6 @@ int mmc_attach_mmc(struct mmc_host *host)
int err; int err;
u32 ocr, rocr; u32 ocr, rocr;
BUG_ON(!host);
WARN_ON(!host->claimed); WARN_ON(!host->claimed);
/* Set correct bus mode for MMC before attempting attach */ /* Set correct bus mode for MMC before attempting attach */
......
...@@ -59,9 +59,6 @@ int mmc_send_status(struct mmc_card *card, u32 *status) ...@@ -59,9 +59,6 @@ int mmc_send_status(struct mmc_card *card, u32 *status)
int err; int err;
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
BUG_ON(!card);
BUG_ON(!card->host);
cmd.opcode = MMC_SEND_STATUS; cmd.opcode = MMC_SEND_STATUS;
if (!mmc_host_is_spi(card->host)) if (!mmc_host_is_spi(card->host))
cmd.arg = card->rca << 16; cmd.arg = card->rca << 16;
...@@ -84,8 +81,6 @@ static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card) ...@@ -84,8 +81,6 @@ static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card)
{ {
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
BUG_ON(!host);
cmd.opcode = MMC_SELECT_CARD; cmd.opcode = MMC_SELECT_CARD;
if (card) { if (card) {
...@@ -101,7 +96,6 @@ static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card) ...@@ -101,7 +96,6 @@ static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card)
int mmc_select_card(struct mmc_card *card) int mmc_select_card(struct mmc_card *card)
{ {
BUG_ON(!card);
return _mmc_select_card(card->host, card); return _mmc_select_card(card->host, card);
} }
...@@ -173,8 +167,6 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) ...@@ -173,8 +167,6 @@ int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
int i, err = 0; int i, err = 0;
BUG_ON(!host);
cmd.opcode = MMC_SEND_OP_COND; cmd.opcode = MMC_SEND_OP_COND;
cmd.arg = mmc_host_is_spi(host) ? 0 : ocr; cmd.arg = mmc_host_is_spi(host) ? 0 : ocr;
cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR;
...@@ -213,9 +205,6 @@ int mmc_all_send_cid(struct mmc_host *host, u32 *cid) ...@@ -213,9 +205,6 @@ int mmc_all_send_cid(struct mmc_host *host, u32 *cid)
int err; int err;
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
BUG_ON(!host);
BUG_ON(!cid);
cmd.opcode = MMC_ALL_SEND_CID; cmd.opcode = MMC_ALL_SEND_CID;
cmd.arg = 0; cmd.arg = 0;
cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR; cmd.flags = MMC_RSP_R2 | MMC_CMD_BCR;
...@@ -233,9 +222,6 @@ int mmc_set_relative_addr(struct mmc_card *card) ...@@ -233,9 +222,6 @@ int mmc_set_relative_addr(struct mmc_card *card)
{ {
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
BUG_ON(!card);
BUG_ON(!card->host);
cmd.opcode = MMC_SET_RELATIVE_ADDR; cmd.opcode = MMC_SET_RELATIVE_ADDR;
cmd.arg = card->rca << 16; cmd.arg = card->rca << 16;
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
...@@ -249,9 +235,6 @@ mmc_send_cxd_native(struct mmc_host *host, u32 arg, u32 *cxd, int opcode) ...@@ -249,9 +235,6 @@ mmc_send_cxd_native(struct mmc_host *host, u32 arg, u32 *cxd, int opcode)
int err; int err;
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
BUG_ON(!host);
BUG_ON(!cxd);
cmd.opcode = opcode; cmd.opcode = opcode;
cmd.arg = arg; cmd.arg = arg;
cmd.flags = MMC_RSP_R2 | MMC_CMD_AC; cmd.flags = MMC_RSP_R2 | MMC_CMD_AC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment