Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1266198 > unrolled thread

regulator: build warning in regulator_lock_supply()

Started byFrank Rowand <frowand.list@gmail.com>
First post2015-11-10 04:30 +0100
Last post2015-11-10 09:40 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  regulator: build warning in regulator_lock_supply() Frank Rowand <frowand.list@gmail.com> - 2015-11-10 04:30 +0100
    Re: regulator: build warning in regulator_lock_supply() Sascha Hauer <s.hauer@pengutronix.de> - 2015-11-10 08:40 +0100
    Re: regulator: build warning in regulator_lock_supply() Mark Brown <broonie@kernel.org> - 2015-11-10 09:40 +0100

#1266198 — regulator: build warning in regulator_lock_supply()

FromFrank Rowand <frowand.list@gmail.com>
Date2015-11-10 04:30 +0100
Subjectregulator: build warning in regulator_lock_supply()
Message-ID<qt7N7-81B-11@gated-at.bofh.it>
In the current Linus tree, new build warning.

When CONFIG_DEBUG_LOCK_ALLOC is not enabled,

  drivers/regulator/core.c: In function 'regulator_lock_supply':
  drivers/regulator/core.c:142:6: warning: unused variable 'i' [-Wunused-variable]


Introduced by commit

  9f01cd4a915e1 ("regulator: core: introduce function to lock regulators and its supplies")
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1266292

FromSascha Hauer <s.hauer@pengutronix.de>
Date2015-11-10 08:40 +0100
Message-ID<qtbH3-24p-11@gated-at.bofh.it>
In reply to#1266198
On Mon, Nov 09, 2015 at 07:21:48PM -0800, Frank Rowand wrote:
> In the current Linus tree, new build warning.
> 
> When CONFIG_DEBUG_LOCK_ALLOC is not enabled,
> 
>   drivers/regulator/core.c: In function 'regulator_lock_supply':
>   drivers/regulator/core.c:142:6: warning: unused variable 'i' [-Wunused-variable]
> 
> 
> Introduced by commit
> 
>   9f01cd4a915e1 ("regulator: core: introduce function to lock regulators and its supplies")

We could fix this with the following patch. On the other hand I'd say
that it's not our fault that mutex_lock_nested() doesn't use the
variable, so maybe it should rather be a static inline function instead
of a define?

Sascha

---------------------------------8<-------------------------------

From cacf0a5ae54b5255dfd895d32e74611c6cbeee3f Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Tue, 10 Nov 2015 08:32:46 +0100
Subject: [PATCH] regulator: core: Fix unused variable warning

When CONFIG_DEBUG_LOCK_ALLOC is not enabled, we get:
  drivers/regulator/core.c: In function 'regulator_lock_supply':
  drivers/regulator/core.c:142:6: warning: unused variable 'i' [-Wunused-variable]

Fix this by adding a __maybe_unused annotation.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/regulator/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 73b7683..2453bce 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -139,7 +139,7 @@ static bool have_full_constraints(void)
 static void regulator_lock_supply(struct regulator_dev *rdev)
 {
 	struct regulator *supply;
-	int i = 0;
+	int __maybe_unused i = 0;
 
 	while (1) {
 		mutex_lock_nested(&rdev->mutex, i++);
-- 
2.6.1


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266325

FromMark Brown <broonie@kernel.org>
Date2015-11-10 09:40 +0100
Message-ID<qtcD8-2Fh-5@gated-at.bofh.it>
In reply to#1266198

[Multipart message — attachments visible in raw view] — view raw

On Mon, Nov 09, 2015 at 07:21:48PM -0800, Frank Rowand wrote:
> In the current Linus tree, new build warning.

> When CONFIG_DEBUG_LOCK_ALLOC is not enabled,

>   drivers/regulator/core.c: In function 'regulator_lock_supply':
>   drivers/regulator/core.c:142:6: warning: unused variable 'i' [-Wunused-variable]

> Introduced by commit

>   9f01cd4a915e1 ("regulator: core: introduce function to lock regulators and its supplies")

There was dome discussion about fixing the lockdep code so this doesn't
happen (since it's perfectly natural code).  I didn't follow where that
went, there was a distraction about the user being buggy which was
addressed.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web