Skip to content

Commit

Permalink
mmc: dw_mmc: Check return value of regulator_enable
Browse files Browse the repository at this point in the history
regulator_enable() is declared with __must_check attribute.
Hence check the return value to ensure that the regulator is enabled.

Fixes the following warning:

drivers/mmc/host/dw_mmc.c:2461:19: warning:
ignoring return value of ‘regulator_enable’, declared with attribute
warn_unused_result [-Wunused-result]
drivers/mmc/host/dw_mmc.c: In function ‘dw_mci_init_slot’:
drivers/mmc/host/dw_mmc.c:1994:19: warning:
ignoring return value of ‘regulator_enable’, declared with attribute
warn_unused_result [-Wunused-result]

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
  • Loading branch information
Sachin Kamat authored and Chris Ball committed Apr 4, 2013
1 parent b0dd099 commit f2f942c
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions drivers/mmc/host/dw_mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1997,8 +1997,14 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
if (IS_ERR(host->vmmc)) {
pr_info("%s: no vmmc regulator found\n", mmc_hostname(mmc));
host->vmmc = NULL;
} else
regulator_enable(host->vmmc);
} else {
ret = regulator_enable(host->vmmc);
if (ret) {
dev_err(host->dev,
"failed to enable regulator: %d\n", ret);
goto err_setup_bus;
}
}

if (dw_mci_get_cd(mmc))
set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
Expand Down Expand Up @@ -2464,8 +2470,14 @@ int dw_mci_resume(struct dw_mci *host)
{
int i, ret;

if (host->vmmc)
regulator_enable(host->vmmc);
if (host->vmmc) {
ret = regulator_enable(host->vmmc);
if (ret) {
dev_err(host->dev,
"failed to enable regulator: %d\n", ret);
return ret;
}
}

if (!mci_wait_reset(host->dev, host)) {
ret = -ENODEV;
Expand Down

0 comments on commit f2f942c

Please sign in to comment.