diff mbox

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

Message ID 20161201010641.11529-4-marex@denx.de
State Accepted
Headers show

Commit Message

Marek Vasut Dec. 1, 2016, 1:06 a.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>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jaehoon Chung Dec. 1, 2016, 4:17 a.m. UTC | #1
On 12/01/2016 10:06 AM, 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>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>

I think that is not related to other patches.
So i will this patch into u-boot-mmc. with Tom's Reviewd-by tag.
(And also PATCH[04/13]~PATCH[07/13]) how about? 
I'm doing the build testing now. If you have any other opinion, let me know, plz.

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/mmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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);
>  
>
Jaehoon Chung Dec. 1, 2016, 5:14 a.m. UTC | #2
On 12/01/2016 10:06 AM, 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>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>

Applied on u-boot-mmc. Thanks!

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/mmc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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);
>  
>
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);