Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1830240ybh; Fri, 17 Jul 2020 02:15:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvIWdC11aI5OcC8CUcxnJvJvsiZHvYFFV+sAurCILHIz7wPEuZz5PbRCtra8Y5MkBD8iki X-Received: by 2002:a50:8adb:: with SMTP id k27mr7996070edk.267.1594977354819; Fri, 17 Jul 2020 02:15:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594977354; cv=none; d=google.com; s=arc-20160816; b=MNaQpT2iORRhQdzEUbgIz9IMJA6L8RQXG9fRpxI4tEjZKdS2s3WHcMVrQTx/sXwNZU sCR9I3nKv9G5KKfRcELPwrYsAhfrjXszm82Kx1fsDsrqobpKVwjzSTfz0cvwlILy0KdN qKtUCcoWvn7LO0+JAqsidy7wP5GCk/LmjODDWOF9N7TcDQFs2OJhDfVphM1w2gl/DDYH ekbSS0PetoobroGZHTjRf8GzTxYrlsjI4yDZOt3cqOpMjMr7uh823kOvZF4bBuzNwCXw 2CX0eMDoOjO+YBnIrgCw0sl7MYOAXLNbFdvOeBsVxHYNYcciQyDiF+Cotv31pZ8UR+C7 4inQ== 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=B8B4j0ZuP4Hg2kXIVQDvDkh/181rJTiRuvYEvSL2wQI=; b=ykENdbnjaWbRaHwF+xtUVDShWrHtlBVZVD/6kWcCQOSKBAJJS6bpnQT4o7VO4jgUAk Q2xxNTtr0WW6surkReS6unC3Nv3A0b1rxhWwfqVKk92PXt9YNoZF/KAUPUJ9cYs79Wb/ cS52cZYvghHROUIE/Rn/9o5PLbzcA0vysU2WjmK4aZjsS4icbnIj0AWwBwBzCgJFVrQr BfTID4xgcWKEDhDHtwLnSaORoW8ovFQSq0uuCRRMZUYVuWoCzyzckMLpQ+F8fuBNYKRx 1BPQBT2jrBciGlV6y0SDgsWXgK8FEZflvE+sUoCCBF2O6h8KDBppoDusFcXc7AddR7+N cRkw== 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 jp14si4883280ejb.93.2020.07.17.02.15.32; Fri, 17 Jul 2020 02:15:54 -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 S1726351AbgGQJNa (ORCPT + 99 others); Fri, 17 Jul 2020 05:13:30 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:36455 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725864AbgGQJNa (ORCPT ); Fri, 17 Jul 2020 05:13:30 -0400 X-Originating-IP: 90.65.108.121 Received: from localhost (lfbn-lyo-1-1676-121.w90-65.abo.wanadoo.fr [90.65.108.121]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 922C0240017; Fri, 17 Jul 2020 09:13:27 +0000 (UTC) Date: Fri, 17 Jul 2020 11:13:27 +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 05/19] clk: at91: sam9x60-pll: use logical or for range check Message-ID: <20200717091327.GM3428@piout.net> References: <1594812267-6697-1-git-send-email-claudiu.beznea@microchip.com> <1594812267-6697-6-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-6-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:13+0300, Claudiu Beznea wrote: > Use logical or for range check. In case bestrate is not in > characteristics->output[0].min..characteristics->output[0].max > range we should return -ERANGE. > > Fixes: a436c2a447e59 ("clk: at91: add sam9x60 PLL driver") > Signed-off-by: Claudiu Beznea Reviewed-by: Alexandre Belloni > --- > drivers/clk/at91/clk-sam9x60-pll.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/clk/at91/clk-sam9x60-pll.c b/drivers/clk/at91/clk-sam9x60-pll.c > index d3152c0afcbf..dfb91c190bd1 100644 > --- a/drivers/clk/at91/clk-sam9x60-pll.c > +++ b/drivers/clk/at91/clk-sam9x60-pll.c > @@ -232,7 +232,7 @@ static long sam9x60_pll_get_best_div_mul(struct sam9x60_pll *pll, > } > > /* Check if bestrate is a valid output rate */ > - if (bestrate < characteristics->output[0].min && > + if (bestrate < characteristics->output[0].min || > bestrate > characteristics->output[0].max) > return -ERANGE; > > -- > 2.7.4 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com