Commit 5df0e823 authored by Shawn Lin's avatar Shawn Lin Committed by Ulf Hansson

mmc: core: remove BUG_ONs from sdio

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 925ff3a7
...@@ -63,7 +63,8 @@ static int sdio_init_func(struct mmc_card *card, unsigned int fn) ...@@ -63,7 +63,8 @@ static int sdio_init_func(struct mmc_card *card, unsigned int fn)
int ret; int ret;
struct sdio_func *func; struct sdio_func *func;
BUG_ON(fn > SDIO_MAX_FUNCS); if (WARN_ON(fn > SDIO_MAX_FUNCS))
return -EINVAL;
func = sdio_alloc_func(card); func = sdio_alloc_func(card);
if (IS_ERR(func)) if (IS_ERR(func))
...@@ -555,7 +556,6 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, ...@@ -555,7 +556,6 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
u32 rocr = 0; u32 rocr = 0;
u32 ocr_card = ocr; u32 ocr_card = ocr;
BUG_ON(!host);
WARN_ON(!host->claimed); WARN_ON(!host->claimed);
/* to query card if 1.8V signalling is supported */ /* to query card if 1.8V signalling is supported */
...@@ -791,9 +791,6 @@ static void mmc_sdio_remove(struct mmc_host *host) ...@@ -791,9 +791,6 @@ static void mmc_sdio_remove(struct mmc_host *host)
{ {
int i; int i;
BUG_ON(!host);
BUG_ON(!host->card);
for (i = 0;i < host->card->sdio_funcs;i++) { for (i = 0;i < host->card->sdio_funcs;i++) {
if (host->card->sdio_func[i]) { if (host->card->sdio_func[i]) {
sdio_remove_func(host->card->sdio_func[i]); sdio_remove_func(host->card->sdio_func[i]);
...@@ -820,9 +817,6 @@ static void mmc_sdio_detect(struct mmc_host *host) ...@@ -820,9 +817,6 @@ static void mmc_sdio_detect(struct mmc_host *host)
{ {
int err; int err;
BUG_ON(!host);
BUG_ON(!host->card);
/* Make sure card is powered before detecting it */ /* Make sure card is powered before detecting it */
if (host->caps & MMC_CAP_POWER_OFF_CARD) { if (host->caps & MMC_CAP_POWER_OFF_CARD) {
err = pm_runtime_get_sync(&host->card->dev); err = pm_runtime_get_sync(&host->card->dev);
...@@ -916,9 +910,6 @@ static int mmc_sdio_resume(struct mmc_host *host) ...@@ -916,9 +910,6 @@ static int mmc_sdio_resume(struct mmc_host *host)
{ {
int err = 0; int err = 0;
BUG_ON(!host);
BUG_ON(!host->card);
/* Basic card reinitialization. */ /* Basic card reinitialization. */
mmc_claim_host(host); mmc_claim_host(host);
...@@ -970,9 +961,6 @@ static int mmc_sdio_power_restore(struct mmc_host *host) ...@@ -970,9 +961,6 @@ static int mmc_sdio_power_restore(struct mmc_host *host)
{ {
int ret; int ret;
BUG_ON(!host);
BUG_ON(!host->card);
mmc_claim_host(host); mmc_claim_host(host);
/* /*
...@@ -1063,7 +1051,6 @@ int mmc_attach_sdio(struct mmc_host *host) ...@@ -1063,7 +1051,6 @@ int mmc_attach_sdio(struct mmc_host *host)
u32 ocr, rocr; u32 ocr, rocr;
struct mmc_card *card; struct mmc_card *card;
BUG_ON(!host);
WARN_ON(!host->claimed); WARN_ON(!host->claimed);
err = mmc_send_io_op_cond(host, 0, &ocr); err = mmc_send_io_op_cond(host, 0, &ocr);
......
...@@ -262,7 +262,8 @@ static int sdio_read_cis(struct mmc_card *card, struct sdio_func *func) ...@@ -262,7 +262,8 @@ static int sdio_read_cis(struct mmc_card *card, struct sdio_func *func)
else else
prev = &card->tuples; prev = &card->tuples;
BUG_ON(*prev); if (*prev)
return -EINVAL;
do { do {
unsigned char tpl_code, tpl_link; unsigned char tpl_code, tpl_link;
......
...@@ -214,7 +214,9 @@ static int sdio_card_irq_put(struct mmc_card *card) ...@@ -214,7 +214,9 @@ static int sdio_card_irq_put(struct mmc_card *card)
struct mmc_host *host = card->host; struct mmc_host *host = card->host;
WARN_ON(!host->claimed); WARN_ON(!host->claimed);
BUG_ON(host->sdio_irqs < 1);
if (host->sdio_irqs < 1)
return -EINVAL;
if (!--host->sdio_irqs) { if (!--host->sdio_irqs) {
if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD)) { if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD)) {
...@@ -261,8 +263,8 @@ int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler) ...@@ -261,8 +263,8 @@ int sdio_claim_irq(struct sdio_func *func, sdio_irq_handler_t *handler)
int ret; int ret;
unsigned char reg; unsigned char reg;
BUG_ON(!func); if (!func)
BUG_ON(!func->card); return -EINVAL;
pr_debug("SDIO: Enabling IRQ for %s...\n", sdio_func_id(func)); pr_debug("SDIO: Enabling IRQ for %s...\n", sdio_func_id(func));
...@@ -304,8 +306,8 @@ int sdio_release_irq(struct sdio_func *func) ...@@ -304,8 +306,8 @@ int sdio_release_irq(struct sdio_func *func)
int ret; int ret;
unsigned char reg; unsigned char reg;
BUG_ON(!func); if (!func)
BUG_ON(!func->card); return -EINVAL;
pr_debug("SDIO: Disabling IRQ for %s...\n", sdio_func_id(func)); pr_debug("SDIO: Disabling IRQ for %s...\n", sdio_func_id(func));
......
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