From patchwork Mon Dec 18 11:31:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 10118819 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 F38E96019C for ; Mon, 18 Dec 2017 11:32:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4A2E28E91 for ; Mon, 18 Dec 2017 11:32:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5E1128E9F; Mon, 18 Dec 2017 11:32:21 +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, UNPARSEABLE_RELAY 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 85CEC28E91 for ; Mon, 18 Dec 2017 11:32:20 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WCM55tM3Opy0sAypR7bwDfnO7MtWRSW/Z3SevlhHKAk=; b=H59y/z0O5/N7xY 22mPAig0ACKNnArWl99QL4bTyXq2gXcPQY9Oxf43LcU1eMCLjqqXjF7uqX0I8jQY9++8ohmnSrUaP 7N+WIeYRhxGlHxR5vy/KiGeRV2Jo3MZvexmKdSk/Jv6nNovFK8svbcXTNGDdbQSqREQTOpMu8oLpu jvYemZzn/JixFKdTmpi6hEM/ihXBFeWTQ2AavNoThYkaISBfzGYZBl6PqoDRPtLOf2omPuoHr+8nt ahSRRiUS+bW9VwKta1MHGqFx9m+6X3DBzkauVqpNmdUW3jHyaPxJcHfmb+09TOdV7FcEpj1eOya1W xVQAT7P79AvhOtWv4tDQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eQtee-0001Lc-Fn; Mon, 18 Dec 2017 11:32:20 +0000 Received: from eddie.linux-mips.org ([148.251.95.138] helo=cvs.linux-mips.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eQtea-0001JJ-Qu for linux-arm-kernel@lists.infradead.org; Mon, 18 Dec 2017 11:32:18 +0000 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23990508AbdLRLbyqRJt9 (ORCPT ); Mon, 18 Dec 2017 12:31:54 +0100 Date: Mon, 18 Dec 2017 12:31:53 +0100 From: Ladislav Michl To: Keerthy Subject: [PATCH 2/2] clocksource: timer-dm: Check prescaler value Message-ID: <20171218113153.GB18637@lenoch> References: <1513059137-21593-1-git-send-email-j-keerthy@ti.com> <20171218111610.GA16906@lenoch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20171218111610.GA16906@lenoch> User-Agent: Mutt/1.9.2 (2017-12-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171218_033217_200270_F2B1BDE8 X-CRM114-Status: UNSURE ( 7.97 ) 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, aaro.koskinen@iki.fi, tony@atomide.com, daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux@armlinux.org.uk, t-kristo@ti.com, thierry.reding@gmail.com, 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 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 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);