Skip to contentSkip to conversation

clocksource/drivers/fsl_ftm_timer: fix error return checking

PATCH New Colin King 2 participants 2 messages Feb 26, 2018

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 clocksource/drivers/fsl_ftm_timer: fix error return checking

From: Colin Ian King <[email protected]>

The error checks on freq for a negative error return always fails because freq is unsigned and can never be negative. Fix this by making freq a signed long.

Detected with Coccinelle:
drivers/clocksource/fsl_ftm_timer.c:287:5-9: WARNING: Unsigned expression compared with zero: freq <= 0 drivers/clocksource/fsl_ftm_timer.c:291:5-9: WARNING: Unsigned expression compared with zero: freq <= 0

Fixes 2529c3a33079 ("clocksource: Add Freescale FlexTimer Module (FTM) timer support")
---
 drivers/clocksource/fsl_ftm_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/fsl_ftm_timer.c +1 -1
index 3ee7e6fea621..846d18daf893 100644
@@ -281,7 +281,7 @@ static int __init __ftm_clk_init(struct device_node *np, char *cnt_name,
 
 static unsigned long __init ftm_clk_init(struct device_node *np)
 {
-	unsigned long freq;
+	long freq;
 
 	freq = __ftm_clk_init(np, "ftm-evt-counter-en", "ftm-evt");
 	if (freq <= 0)
Signature · 1 line
2.15.1
#1 lore raw

[tip:timers/urgent] clocksource/drivers/fsl_ftm_timer: Fix error return checking

clocksource/drivers/fsl_ftm_timer: Fix error return checking
Commit-ID:  f287eb9013ccf199cbfa4eabd80c36fedfc15a73
Gitweb:     https://git.kernel.org/tip/f287eb9013ccf199cbfa4eabd80c36fedfc15a73
Author:     Colin Ian King <[email protected]>
AuthorDate: Mon, 26 Feb 2018 11:36:14 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Mon, 26 Feb 2018 13:56:05 +0100

clocksource/drivers/fsl_ftm_timer: Fix error return checking

The error checks on freq for a negative error return always fails because freq is unsigned and can never be negative. Fix this by making freq a signed long.

Detected with Coccinelle:
drivers/clocksource/fsl_ftm_timer.c:287:5-9: WARNING: Unsigned expression compared with zero: freq <= 0 drivers/clocksource/fsl_ftm_timer.c:291:5-9: WARNING: Unsigned expression compared with zero: freq <= 0

Fixes 2529c3a33079 ("clocksource: Add Freescale FlexTimer Module (FTM) timer support")
Cc Daniel Lezcano <[email protected]>
---
 drivers/clocksource/fsl_ftm_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/fsl_ftm_timer.c +1 -1
index 3ee7e6fea621..846d18daf893 100644
@@ -281,7 +281,7 @@ static int __init __ftm_clk_init(struct device_node *np, char *cnt_name,
 
 static unsigned long __init ftm_clk_init(struct device_node *np)
 {
-	unsigned long freq;
+	long freq;
 
 	freq = __ftm_clk_init(np, "ftm-evt-counter-en", "ftm-evt");
 	if (freq <= 0)