Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f287eb90 authored by Colin Ian King's avatar Colin Ian King Committed by Thomas Gleixner
Browse files

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: 2529c3a3 ("clocksource: Add Freescale FlexTimer Module (FTM) timer support")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: kernel-janitors@vger.kernel.org
Link: https://lkml.kernel.org/r/20180226113614.3092-1-colin.king@canonical.com
parent 4a3928c6
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -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)
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");
	freq = __ftm_clk_init(np, "ftm-evt-counter-en", "ftm-evt");
	if (freq <= 0)
	if (freq <= 0)