From patchwork Tue Jan 2 10:09:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 10140229 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 94C05601A1 for ; Tue, 2 Jan 2018 10:13:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 953A528AB5 for ; Tue, 2 Jan 2018 10:13:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8989428AB7; Tue, 2 Jan 2018 10:13:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0113D28AB5 for ; Tue, 2 Jan 2018 10:13:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751938AbeABKNK (ORCPT ); Tue, 2 Jan 2018 05:13:10 -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 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w02AAton013390; Tue, 2 Jan 2018 04:10:55 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1514887855; bh=Fayh2zdzfbbkD2NgWQVdPYsqP2qE8MFAjVRcYrixPvc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=eM4IXYQxaCuxLzRYM3s9R9q+LGmlyoWleIqy3jHJhBYVEVkV2IlU7YTCN3pUQERVZ ZpA/MnCaNLNc+u+0tGlKvli88y6BLmFa64qeB73cHRnQ5HJMNvKaUNEMLcGBVAIl0w cLgLXDLKU8raBO1TWOantE8wMxyIx3if6ps43HFo= Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w02AAoq1026372; Tue, 2 Jan 2018 04:10:50 -0600 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Tue, 2 Jan 2018 04:10:49 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Tue, 2 Jan 2018 04:10:49 -0600 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w02AA31T003092; Tue, 2 Jan 2018 04:10:46 -0600 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 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);