* [PATCH] regulator: qcom-saw: avoid uninitialized variable warning
@ 2016-02-11 9:38 Arnd Bergmann
2016-02-19 16:17 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2016-02-11 9:38 UTC (permalink / raw)
To: Mark Brown
Cc: linux-arm-kernel, Arnd Bergmann, Georgi Djakov, Liam Girdwood,
linux-kernel
gcc cannot know that a for_each_possible_cpu() loop always executes
at least once, so it warns about the use of the "found" variable
in qcom_saw_regulator_probe:
drivers/regulator/qcom_saw-regulator.c: In function 'qcom_saw_regulator_probe':
drivers/regulator/qcom_saw-regulator.c:154:5: error: 'found' is used uninitialized in this function [-Werror=uninitialized]
This adds an explicit initialization to avoid the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 18bba3b50355 ("regulator: qcom-saw: Add support for SAW regulators")
---
drivers/regulator/qcom_saw-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/qcom_saw-regulator.c b/drivers/regulator/qcom_saw-regulator.c
index c800f16adaf0..30af1d380f9f 100644
--- a/drivers/regulator/qcom_saw-regulator.c
+++ b/drivers/regulator/qcom_saw-regulator.c
@@ -137,7 +137,7 @@ static struct saw_vreg *saw_get_drv(struct platform_device *pdev,
struct saw_vreg *vreg = NULL;
struct device_node *cpu_node, *saw_node;
int cpu;
- bool found;
+ bool found = 0;
for_each_possible_cpu(cpu) {
cpu_node = of_cpu_device_node_get(cpu);
--
2.7.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] regulator: qcom-saw: avoid uninitialized variable warning
2016-02-11 9:38 [PATCH] regulator: qcom-saw: avoid uninitialized variable warning Arnd Bergmann
@ 2016-02-19 16:17 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2016-02-19 16:17 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-arm-kernel, Georgi Djakov, Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 287 bytes --]
On Thu, Feb 11, 2016 at 10:38:08AM +0100, Arnd Bergmann wrote:
> gcc cannot know that a for_each_possible_cpu() loop always executes
> at least once, so it warns about the use of the "found" variable
> in qcom_saw_regulator_probe:
I'm going to drop this driver so this won't be needed.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-20 17:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-11 9:38 [PATCH] regulator: qcom-saw: avoid uninitialized variable warning Arnd Bergmann
2016-02-19 16:17 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®