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: 10140251 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 D91096034B for ; Tue, 2 Jan 2018 10:27:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEFB928ABB for ; Tue, 2 Jan 2018 10:27:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3D2A28ABD; Tue, 2 Jan 2018 10:27:50 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6551928ABB for ; Tue, 2 Jan 2018 10:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OlGl5XcNJDBCrAqpDX69MlRqxsOXAboo90KJUekY0NA=; b=EWnyGuepfMJeLL OkPtEySv+FgWrpugMPhFpHUe4GV1wztOSnUAdwHNoEEpZIRajt+oDx/garBbgbXzMLILoN6x5/ZkO 9EnMztR+87Nfmf5vTgCSAxdYnkU1J5SFosPSPxyfmeqnSJbZwCj/jbIyulrBv+fx1RK/HlK35idXD bBjkq4CAlLo4mLiPZ70H+yl7j1q47F49Db0duXhVunSpJ3Ds2dLE+T3mGbnOv4Vr5gYeOJDPQW8rh LJzthg7UT8itBqJ7vGXkC6iLGnIzA+UEi24+HxgHJlGiDuXwJi18D9MVDwEaV/PZHnT3lnkCc7fxj 34FoovWUiRoymn0HIr1g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eWJnO-0002St-1c; Tue, 02 Jan 2018 10:27:46 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eWJn6-0001zb-3K for linux-arm-kernel@bombadil.infradead.org; Tue, 02 Jan 2018 10:27:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZnC9lxN/dPv/zmNUq1GwxyjBjllf39wqEIw8XisF1Qs=; b=hfu5bnQlGksKbpcu9OJGHNHcA qdd0D4R/aKJPwJZYBuXHTlejk2Ot967sld4zK1Lb49+sfcdNmxogL2jaFQA3bEVafsnuiC1yjiqi6 iZdZjDo49Tp6D7g9CuN9hkMl/zfrCsUU6yi/Uym1BDQUI58Uwu6SNCDxZG7nd1DtlMfK9w8ww8GgR osbu7uJniZqBX1zOnS0ntOzEXPNL+Mtcz7zda9/XbPYizJ9iV2fTV2MbbDl98jv/R5bbpRa5Gu3/7 bDwahRGjEaj8I7Rt1czTssxaWFywh2+1QQVHnvd6gEL1KgyHc9hOPDd7Hy3BkXwbnrza/QK1tLu21 M5a6eV+4A==; Received: from fllnx209.ext.ti.com ([198.47.19.16]) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eWJZ7-0001Zw-7a for linux-arm-kernel@lists.infradead.org; Tue, 02 Jan 2018 10:13:02 +0000 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: , , , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180102_101301_481484_5BCF0851 X-CRM114-Status: UNSURE ( 9.56 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, grygorii.strashko@ti.com, j-keerthy@ti.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, t-kristo@ti.com, ladis@linux-mips.org, sebastian.reichel@collabora.co.uk, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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);