Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760645AbdLSIby (ORCPT ); Tue, 19 Dec 2017 03:31:54 -0500 Received: from lelnx193.ext.ti.com ([198.47.27.77]:13335 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759562AbdLSIbr (ORCPT ); Tue, 19 Dec 2017 03:31:47 -0500 Subject: Re: [PATCH 2/2] clocksource: timer-dm: Check prescaler value To: Ladislav Michl CC: , , , , , , , , , , , , References: <1513059137-21593-1-git-send-email-j-keerthy@ti.com> <20171218111610.GA16906@lenoch> <20171218113153.GB18637@lenoch> From: Keerthy Message-ID: Date: Tue, 19 Dec 2017 14:00:52 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171218113153.GB18637@lenoch> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit 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 Content-Length: 976 Lines: 31 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. > > 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); > >