* regulator: build warning in regulator_lock_supply() @ 2015-11-10 3:21 Frank Rowand 2015-11-10 7:36 ` Sascha Hauer 2015-11-10 8:36 ` Mark Brown 0 siblings, 2 replies; 3+ messages in thread From: Frank Rowand @ 2015-11-10 3:21 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Sascha Hauer, Linux Kernel list 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") ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: regulator: build warning in regulator_lock_supply() 2015-11-10 3:21 regulator: build warning in regulator_lock_supply() Frank Rowand @ 2015-11-10 7:36 ` Sascha Hauer 2015-11-10 8:36 ` Mark Brown 1 sibling, 0 replies; 3+ messages in thread From: Sascha Hauer @ 2015-11-10 7:36 UTC (permalink / raw) To: Frank Rowand; +Cc: Liam Girdwood, Mark Brown, Linux Kernel list 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 | ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: regulator: build warning in regulator_lock_supply() 2015-11-10 3:21 regulator: build warning in regulator_lock_supply() Frank Rowand 2015-11-10 7:36 ` Sascha Hauer @ 2015-11-10 8:36 ` Mark Brown 1 sibling, 0 replies; 3+ messages in thread From: Mark Brown @ 2015-11-10 8:36 UTC (permalink / raw) To: Frank Rowand; +Cc: Liam Girdwood, Sascha Hauer, Linux Kernel list [-- Attachment #1: Type: text/plain, Size: 653 bytes --] 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. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 473 bytes --] ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-10 8:37 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-11-10 3:21 regulator: build warning in regulator_lock_supply() Frank Rowand 2015-11-10 7:36 ` Sascha Hauer 2015-11-10 8:36 ` Mark Brown
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.