Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1827826ybh; Fri, 17 Jul 2020 02:11:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsBR2lFXs0JYeXWX4e0QrUMQGJxF/7d1u/2N7hLSF4gmWNVcZfCsLGDAtqpIRaz/ov20PR X-Received: by 2002:a17:906:1d5b:: with SMTP id o27mr8104265ejh.367.1594977090382; Fri, 17 Jul 2020 02:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594977090; cv=none; d=google.com; s=arc-20160816; b=Svwa28CMTOLXMhNPIj4O8FBX9TMTK4rRH47cn1iXVpIUOI8kyKbPU2rD7Yso2X5Q/m ee2m2el+ZNHkbaWSJlF9T4yCvy9aI9/d72RFobrjZ55tJSHV4JVJRiQDOko7y/VDLLlW L9kR5uc4Hs8Xrlh43o3XdCZ/UQSAbL8Fh9WBIvLeWz+zQPD2GO2ZK6zTNKqqig6hqr2f tZAS4F4gzYH3em14ALhKpXyi1TV7uI6k0rGkW7DrQnVj/JA1rqiU+uO0ih5bcKhMC8Cs 6aqtocsG0MNir05g4CMq/wZPGZeTWS8MOC26b6u4OOBmcMiVKzsIwHr3Wao9fo1oESYV kbCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=TgdLtZskdBKC2P5jcTSpYOJMRiu0LckiUENR5zmdz3s=; b=LRsysD4CJ/3rLumlNurm6XTvFSqwqOoV8+WEZc4pK3NeNwe6X7QEuP+9l6U48GZiZW WhWM3NZa0sCv75PwrRLtYtLUXa6LSssnlU7PqXwuMsd07J5IQ2jvY9IUl26COaBRXUKP eGH/snxiDGC0I545S3v9pS1LP4uSoAYANcXrixrER2MchCjziraNm5CKJUGCpCUC3Hbr NNOuCY+zSV8FO6MHS+Qcma6CKVQDSY7+skQKd3vepqkydow8kXbMdSQNJedrh50y609r VMvZYex+RYSenbbvlTZe7PNo8CqiXAaqFff+Blc80jGYGf8KdwcCvh85kHzw1y1l5rDc fu6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y21si4688551edt.483.2020.07.17.02.11.07; Fri, 17 Jul 2020 02:11:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726686AbgGQJKn (ORCPT + 99 others); Fri, 17 Jul 2020 05:10:43 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:40853 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbgGQJKm (ORCPT ); Fri, 17 Jul 2020 05:10:42 -0400 Received: from localhost (lfbn-lyo-1-1676-121.w90-65.abo.wanadoo.fr [90.65.108.121]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay11.mail.gandi.net (Postfix) with ESMTPSA id EAC4F100007; Fri, 17 Jul 2020 09:10:36 +0000 (UTC) Date: Fri, 17 Jul 2020 11:10:36 +0200 From: Alexandre Belloni To: Claudiu Beznea Cc: mturquette@baylibre.com, sboyd@kernel.org, nicolas.ferre@microchip.com, ludovic.desroches@microchip.com, bbrezillon@kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 02/19] clk: at91: clk-generated: check best_rate against ranges Message-ID: <20200717091036.GJ3428@piout.net> References: <1594812267-6697-1-git-send-email-claudiu.beznea@microchip.com> <1594812267-6697-3-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1594812267-6697-3-git-send-email-claudiu.beznea@microchip.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/07/2020 14:24:10+0300, Claudiu Beznea wrote: > Check best_rate against available clock ranges. > > Fixes: df70aeef6083 ("clk: at91: add generated clock driver") > Signed-off-by: Claudiu Beznea Reviewed-by: Alexandre Belloni > --- > drivers/clk/at91/clk-generated.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c > index 995a13133cfb..f8e557e0e1b8 100644 > --- a/drivers/clk/at91/clk-generated.c > +++ b/drivers/clk/at91/clk-generated.c > @@ -185,8 +185,8 @@ static int clk_generated_determine_rate(struct clk_hw *hw, > __clk_get_name((req->best_parent_hw)->clk), > req->best_parent_rate); > > - if (best_rate < 0) > - return best_rate; > + if (best_rate < 0 || (gck->range.max && best_rate > gck->range.max)) > + return -EINVAL; > > req->rate = best_rate; > return 0; > -- > 2.7.4 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com