Skip to contentSkip to conversation

PM / domains: Fix 'may be used uninitialized' build warning

PATCH Applied Augusto Mecking Caringi 2 participants 2 messages Dec 30, 2016 – Jan 6, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM / domains: Fix 'may be used uninitialized' build warning

This patch fixes the following gcc warning:

drivers/base/power/domain.c: In function ‘genpd_runtime_resume’:
drivers/base/power/domain.c:642:14: warning: ‘time_start’ may be used uninitialized in this function [-Wmaybe-uninitialized]
elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)

The same problem (in another function in this same file) was fixed in commit d33d5a6c88fc (avoid spurious "may be used uninitialized" warning)

---
 drivers/base/power/domain.c | 1 +
 1 file changed, 1 insertion(+)
drivers/base/power/domain.c +1 -0
index a5e1262..2997026 100644
@@ -626,6 +626,7 @@ static int genpd_runtime_resume(struct device *dev)
 
  out:
 	/* Measure resume latency. */
+	time_start = 0;
 	if (timed && runtime_pm)
 		time_start = ktime_get();
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 20 lines · Augusto Mecking Caringi

This patch fixes the following gcc warning:

drivers/base/power/domain.c: In function ‘genpd_runtime_resume’:
drivers/base/power/domain.c:642:14: warning: ‘time_start’ may be used uninitialized in this function [-Wmaybe-uninitialized]
elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)

The same problem (in another function in this same file) was fixed in commit d33d5a6c88fc (avoid spurious "may be used uninitialized" warning)

---
 drivers/base/power/domain.c | 1 +
 1 file changed, 1 insertion(+)
drivers/base/power/domain.c +0 -0
index a5e1262..2997026 100644

drivers/base/power/domain.c static int genpd_runtime_resume(struct device *dev) · line 631

Quoted 6 lines
drivers/base/power/domain.c +1 -0
@@ -626,6 +626,7 @@ static int genpd_runtime_resume(struct device *dev)
 
  out:
 	/* Measure resume latency. */
+	time_start = 0;
 	if (timed && runtime_pm)
 		time_start = ktime_get();

Applied.

Thanks,
Rafael