Commit 349583d6 authored by Shawn Lin's avatar Shawn Lin Committed by Ulf Hansson

mmc: core: remove BUG_ONs from sd

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 8cce3ecc
...@@ -927,7 +927,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, ...@@ -927,7 +927,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
u32 cid[4]; u32 cid[4];
u32 rocr = 0; u32 rocr = 0;
BUG_ON(!host);
WARN_ON(!host->claimed); WARN_ON(!host->claimed);
err = mmc_sd_get_cid(host, ocr, cid, &rocr); err = mmc_sd_get_cid(host, ocr, cid, &rocr);
...@@ -1043,9 +1042,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, ...@@ -1043,9 +1042,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
*/ */
static void mmc_sd_remove(struct mmc_host *host) static void mmc_sd_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;
} }
...@@ -1065,9 +1061,6 @@ static void mmc_sd_detect(struct mmc_host *host) ...@@ -1065,9 +1061,6 @@ static void mmc_sd_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);
/* /*
...@@ -1091,9 +1084,6 @@ static int _mmc_sd_suspend(struct mmc_host *host) ...@@ -1091,9 +1084,6 @@ static int _mmc_sd_suspend(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))
...@@ -1136,9 +1126,6 @@ static int _mmc_sd_resume(struct mmc_host *host) ...@@ -1136,9 +1126,6 @@ static int _mmc_sd_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))
...@@ -1221,7 +1208,6 @@ int mmc_attach_sd(struct mmc_host *host) ...@@ -1221,7 +1208,6 @@ int mmc_attach_sd(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);
err = mmc_send_app_op_cond(host, 0, &ocr); err = mmc_send_app_op_cond(host, 0, &ocr);
......
...@@ -27,8 +27,8 @@ int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card) ...@@ -27,8 +27,8 @@ int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
int err; int err;
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
BUG_ON(!host); if (WARN_ON(card && card->host != host))
BUG_ON(card && (card->host != host)); return -EINVAL;
cmd.opcode = MMC_APP_CMD; cmd.opcode = MMC_APP_CMD;
...@@ -72,8 +72,8 @@ int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card, ...@@ -72,8 +72,8 @@ int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card,
int i, err; int i, err;
BUG_ON(!cmd); if (retries < 0)
BUG_ON(retries < 0); retries = MMC_CMD_RETRIES;
err = -EIO; err = -EIO;
...@@ -122,9 +122,6 @@ int mmc_app_set_bus_width(struct mmc_card *card, int width) ...@@ -122,9 +122,6 @@ int mmc_app_set_bus_width(struct mmc_card *card, int width)
{ {
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
BUG_ON(!card);
BUG_ON(!card->host);
cmd.opcode = SD_APP_SET_BUS_WIDTH; cmd.opcode = SD_APP_SET_BUS_WIDTH;
cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
...@@ -147,8 +144,6 @@ int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) ...@@ -147,8 +144,6 @@ int mmc_send_app_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 = SD_APP_OP_COND; cmd.opcode = SD_APP_OP_COND;
if (mmc_host_is_spi(host)) if (mmc_host_is_spi(host))
cmd.arg = ocr & (1 << 30); /* SPI only defines one bit */ cmd.arg = ocr & (1 << 30); /* SPI only defines one bit */
...@@ -224,9 +219,6 @@ int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca) ...@@ -224,9 +219,6 @@ int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca)
int err; int err;
struct mmc_command cmd = {0}; struct mmc_command cmd = {0};
BUG_ON(!host);
BUG_ON(!rca);
cmd.opcode = SD_SEND_RELATIVE_ADDR; cmd.opcode = SD_SEND_RELATIVE_ADDR;
cmd.arg = 0; cmd.arg = 0;
cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR; cmd.flags = MMC_RSP_R6 | MMC_CMD_BCR;
...@@ -249,10 +241,6 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr) ...@@ -249,10 +241,6 @@ int mmc_app_send_scr(struct mmc_card *card, u32 *scr)
struct scatterlist sg; struct scatterlist sg;
void *data_buf; void *data_buf;
BUG_ON(!card);
BUG_ON(!card->host);
BUG_ON(!scr);
/* NOTE: caller guarantees scr is heap-allocated */ /* NOTE: caller guarantees scr is heap-allocated */
err = mmc_app_cmd(card->host, card); err = mmc_app_cmd(card->host, card);
...@@ -307,9 +295,6 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group, ...@@ -307,9 +295,6 @@ int mmc_sd_switch(struct mmc_card *card, int mode, int group,
struct mmc_data data = {0}; struct mmc_data data = {0};
struct scatterlist sg; struct scatterlist sg;
BUG_ON(!card);
BUG_ON(!card->host);
/* NOTE: caller guarantees resp is heap-allocated */ /* NOTE: caller guarantees resp is heap-allocated */
mode = !!mode; mode = !!mode;
...@@ -352,10 +337,6 @@ int mmc_app_sd_status(struct mmc_card *card, void *ssr) ...@@ -352,10 +337,6 @@ int mmc_app_sd_status(struct mmc_card *card, void *ssr)
struct mmc_data data = {0}; struct mmc_data data = {0};
struct scatterlist sg; struct scatterlist sg;
BUG_ON(!card);
BUG_ON(!card->host);
BUG_ON(!ssr);
/* NOTE: caller guarantees ssr is heap-allocated */ /* NOTE: caller guarantees ssr is heap-allocated */
err = mmc_app_cmd(card->host, card); err = mmc_app_cmd(card->host, card);
......
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