Patchwork mtd: mxc_nand: Fix warning on nr_parts unused variable

login
register
mail settings
Submitter Fabio Estevam
Date Nov. 23, 2010, 7:02 p.m.
Message ID <1290538933-12607-1-git-send-email-fabio.estevam@freescale.com>
Download mbox | patch
Permalink /patch/72729/
State Accepted
Commit 2ebf0622cdc5d2b51f22b68a0983d90df8a976c8
Headers show

Comments

Fabio Estevam - Nov. 23, 2010, 7:02 p.m.
If CONFIG_MTD_PARTITIONS is not selected, then the following warning is generated:

  CC      drivers/mtd/nand/mxc_nand.o
drivers/mtd/nand/mxc_nand.c: In function 'mxcnd_probe':
drivers/mtd/nand/mxc_nand.c:1014: warning: unused variable 'nr_parts'

Fix it by marking nr_parts as __maybe_unused.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/mtd/nand/mxc_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Artem Bityutskiy - Nov. 29, 2010, 2:51 p.m.
On Tue, 2010-11-23 at 17:02 -0200, Fabio Estevam wrote:
> If CONFIG_MTD_PARTITIONS is not selected, then the following warning is generated:
> 
>   CC      drivers/mtd/nand/mxc_nand.o
> drivers/mtd/nand/mxc_nand.c: In function 'mxcnd_probe':
> drivers/mtd/nand/mxc_nand.c:1014: warning: unused variable 'nr_parts'
> 
> Fix it by marking nr_parts as __maybe_unused.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

I'm curious, do you really use MTD without CONFIG_MTD_PARTITIONS ? Or
you found just random warning? I'm asking because I believed this config
option has to be killed, because it causes more harm in form of mess,
than good.

Anyway, putting this to my l2-mtd-2.6.git, thanks.
Fabio Estevam - Nov. 29, 2010, 3:10 p.m.
On 11/29/2010 12:51 PM, Artem Bityutskiy wrote:
> On Tue, 2010-11-23 at 17:02 -0200, Fabio Estevam wrote:
>  > If CONFIG_MTD_PARTITIONS is not selected, then the following warning
> is generated:
>  >
>  > CC drivers/mtd/nand/mxc_nand.o
>  > drivers/mtd/nand/mxc_nand.c: In function 'mxcnd_probe':
>  > drivers/mtd/nand/mxc_nand.c:1014: warning: unused variable 'nr_parts'
>  >
>  > Fix it by marking nr_parts as __maybe_unused.
>  >
>  > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
>
> I'm curious, do you really use MTD without CONFIG_MTD_PARTITIONS ? Or
> you found just random warning? I'm asking because I believed this config
> option has to be killed, because it causes more harm in form of mess,
> than good.

I was using it without CONFIG_MTD_PARTITIONS because first I was trying 
to get the NAND to be detected only.

> Anyway, putting this to my l2-mtd-2.6.git, thanks.

Thanks,

Fabio Estevam

Patch

diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 214b03a..ef932ba 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1009,7 +1009,7 @@  static int __init mxcnd_probe(struct platform_device *pdev)
 	struct mxc_nand_platform_data *pdata = pdev->dev.platform_data;
 	struct mxc_nand_host *host;
 	struct resource *res;
-	int err = 0, nr_parts = 0;
+	int err = 0, __maybe_unused nr_parts = 0;
 	struct nand_ecclayout *oob_smallpage, *oob_largepage;
 
 	/* Allocate memory for MTD device structure and private data */