Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752560AbeABKNL (ORCPT + 1 other); Tue, 2 Jan 2018 05:13:11 -0500 Received: from fllnx209.ext.ti.com ([198.47.19.16]:12098 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751552AbeABKNI (ORCPT ); Tue, 2 Jan 2018 05:13:08 -0500 From: Keerthy To: , , , CC: , , , , , , , , , Subject: [PATCH v6 10/10] clocksource: timer-dm: Check prescaler value Date: Tue, 2 Jan 2018 15:39:59 +0530 Message-ID: <1514887799-24605-11-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1514887799-24605-1-git-send-email-j-keerthy@ti.com> References: <1514887799-24605-1-git-send-email-j-keerthy@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Ladislav Michl 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. Signed-off-by: Ladislav Michl --- 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 60db173..01a9cb0 100644 --- a/drivers/clocksource/timer-dm.c +++ b/drivers/clocksource/timer-dm.c @@ -672,6 +672,9 @@ int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler) 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); -- 1.9.1