Thread (33 messages) 33 messages, 3 authors, 2017-12-20

[PATCH 2/2] clocksource: timer-dm: Check prescaler value

From: j-keerthy@ti.com (Keerthy)
Date: 2017-12-19 08:31:54
Also in: linux-omap, linux-pwm, lkml


On Monday 18 December 2017 05:01 PM, Ladislav Michl wrote:
Invalid prescaler value is silently ignored. Fix that
by returning -EINVAL in such case. As invalid value
disabled use of the prescaler, use -1 explicitely for
that purpose.
Thanks. I will post this as part of my migration series.
quoted hunk ↗ jump to hunk
Signed-off-by: Ladislav Michl <redacted>
---
 drivers/clocksource/timer-dm.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/clocksource/timer-dm.c b/drivers/clocksource/timer-dm.c
index ec3a28c90c70..95cd98be8541 100644
--- a/drivers/clocksource/timer-dm.c
+++ b/drivers/clocksource/timer-dm.c
@@ -609,6 +609,9 @@ static int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer,
 	if (prescaler >= 0x00 && prescaler <= 0x07) {
 		l |= OMAP_TIMER_CTRL_PRE;
 		l |= prescaler << 2;
+	} else {
+		if (prescaler != -1)
+			return -EINVAL;
 	}
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help