diff mbox

[U-Boot,03/14] mmc: Fix warning if debug() is not used

Message ID 20161125223235.3434-3-marex@denx.de
State Accepted
Commit ce9eca9438d69306441060e7ac90e45d47882f34
Delegated to: Jaehoon Chung
Headers show

Commit Message

Marek Vasut Nov. 25, 2016, 10:32 p.m. UTC
If debug() is not used, then the whole content of debug(...) will
be removed by the preprocessor, which will result in the following
warning. This patch adds __maybe_unused annotation to fix this.

drivers/mmc/mmc.c: In function ‘mmc_init’:
drivers/mmc/mmc.c:1685:11: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]
  unsigned start;

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: Tom Rini <trini@konsulko.com>
---
 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini Nov. 26, 2016, 8:44 p.m. UTC | #1
On Fri, Nov 25, 2016 at 11:32:24PM +0100, Marek Vasut wrote:

> If debug() is not used, then the whole content of debug(...) will
> be removed by the preprocessor, which will result in the following
> warning. This patch adds __maybe_unused annotation to fix this.
> 
> drivers/mmc/mmc.c: In function ‘mmc_init’:
> drivers/mmc/mmc.c:1685:11: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]
>   unsigned start;
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
> Cc: Tom Rini <trini@konsulko.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox

Patch

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index d6b7e4f..6e25b67 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1708,7 +1708,7 @@  static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
 	int err = 0;
-	unsigned start;
+	__maybe_unused unsigned start;
 #ifdef CONFIG_DM_MMC
 	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(mmc->dev);