Patchwork drivers: mtd: mtdcore: Fix build warning when CONFIG_MTD_CHAR is not defined

login
register
mail settings
Submitter Fabio Estevam
Date Jan. 12, 2012, 3:25 a.m.
Message ID <1326338704-30199-1-git-send-email-festevam@gmail.com>
Download mbox | patch
Permalink /patch/135548/
State Accepted
Commit 335a5f409ee3960bda6b112b9d1a89d0a4e0a7eb
Headers show

Comments

Fabio Estevam - Jan. 12, 2012, 3:25 a.m.
Fix the following build warning:

drivers/mtd/mtdcore.c: In function ‘mtd_release’:
drivers/mtd/mtdcore.c:110: warning: unused variable ‘mtd’

This happens when neither CONFIG_MTD_CHAR nor CONFIG_MTD_CHAR_MODULE are defined.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/mtd/mtdcore.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Artem Bityutskiy - Jan. 14, 2012, 3:18 p.m.
On Thu, 2012-01-12 at 01:25 -0200, Fabio Estevam wrote:
> Fix the following build warning:
> 
> drivers/mtd/mtdcore.c: In function ‘mtd_release’:
> drivers/mtd/mtdcore.c:110: warning: unused variable ‘mtd’
> 
> This happens when neither CONFIG_MTD_CHAR nor CONFIG_MTD_CHAR_MODULE are defined.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Pushed to l2-mtd.git, thanks!

Patch

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 6ae9ca0..b265188 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -107,7 +107,7 @@  static LIST_HEAD(mtd_notifiers);
  */
 static void mtd_release(struct device *dev)
 {
-	struct mtd_info *mtd = dev_get_drvdata(dev);
+	struct mtd_info __maybe_unused *mtd = dev_get_drvdata(dev);
 	dev_t index = MTD_DEVT(mtd->index);
 
 	/* remove /dev/mtdXro node if needed */