diff mbox

[v2,1/2] mmc: dw_mmc: Check return value of regulator_enable

Message ID 1365054911-19928-1-git-send-email-sachin.kamat@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sachin Kamat April 4, 2013, 5:55 a.m. UTC
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>
---
Changes since v1:
Changed 'if (ret != 0)' to 'if (ret)'
---
 drivers/mmc/host/dw_mmc.c |   20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

Comments

Seungwon Jeon April 4, 2013, 6:11 a.m. UTC | #1
On Thursday, April 04, 2013, Sachin Kamat wrote:
> 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>

Thanks,
Seungwon Jeon

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chris Ball April 4, 2013, 2:18 p.m. UTC | #2
Hi,

On Thu, Apr 04 2013, Seungwon Jeon wrote:
> On Thursday, April 04, 2013, Sachin Kamat wrote:
>> 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>

Thanks, both patches pushed to mmc-next for 3.10.

- Chris.
diff mbox

Patch

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index a443820..4e3ebff 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1990,8 +1990,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);
@@ -2457,8 +2463,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;