lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161122143401.1889409-1-arnd@arndb.de>
Date:   Tue, 22 Nov 2016 15:33:44 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Daniel Lezcano <daniel.lezcano@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>
Cc:     Arnd Bergmann <arnd@...db.de>, Noam Camus <noamca@...lanox.com>,
        Vineet Gupta <vgupta@...opsys.com>,
        Liviu Dudau <Liviu.Dudau@....com>, linux-kernel@...r.kernel.org
Subject: [PATCH] clocksource: nps: avoid maybe-uninitialized warning

We get a harmless false-positive warning with the newly added nps
clocksource driver:

drivers/clocksource/timer-nps.c: In function 'nps_setup_clocksource':
drivers/clocksource/timer-nps.c:102:6: error: 'nps_timer1_freq' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Gcc here fails to identify that IS_ERR() is only true if PTR_ERR()
has a nonzero value. Using PTR_ERR_OR_ZERO() to convert the result
first makes this obvious and shuts up the warning.

Fixes: 0ee4d9922df5 ("clocksource: Add clockevent support to NPS400 driver")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 drivers/clocksource/timer-nps.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/timer-nps.c b/drivers/clocksource/timer-nps.c
index b4c8a023a2d4..8da5e93b6810 100644
--- a/drivers/clocksource/timer-nps.c
+++ b/drivers/clocksource/timer-nps.c
@@ -53,9 +53,10 @@ static int __init nps_get_timer_clk(struct device_node *node,
 	int ret;
 
 	*clk = of_clk_get(node, 0);
-	if (IS_ERR(*clk)) {
+	ret = PTR_ERR_OR_ZERO(*clk);
+	if (ret) {
 		pr_err("timer missing clk");
-		return PTR_ERR(*clk);
+		return ret;
 	}
 
 	ret = clk_prepare_enable(*clk);
-- 
2.9.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ