Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp397362ybh; Wed, 15 Jul 2020 05:04:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfTRzx+LNFbPrIiQUr2BcinNEyrtQKvNFmfu9HpmOMOIMAI7eBOiwN4KJWtL3XJZUGUkxh X-Received: by 2002:aa7:d285:: with SMTP id w5mr9538616edq.174.1594814691681; Wed, 15 Jul 2020 05:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594814691; cv=none; d=google.com; s=arc-20160816; b=OiVLkxSI6KWMCJjVZ6iScBxy6v9GJLJik4/rucg0x0LOjBYEFPilDxd578ktshhMs4 ROxZuFJwvNiM2St7jh/7EJUiLVL2scTdyf9S9rlp/gPz04tHKMp8sA1c1RAm/8Tby8TB goKKHvwWt3+/WFycmZjORyewUOrf4PUBAcAPSAHuS72lSl70FSToP+4L1OZX/qHU34jJ Nx1LLkMQYmgsrATvQYtVcESklMjyuJvWG7qKlQXQnBS8KgspVL8bQ2AfMcnxwqHlDuVt reJfYyeu1/jh5LzXyX6+qpyQST8j/qQmm8KM/1JX3uuTFIzhijsle1Y57n5fM0+ReK4o oYhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:dkim-signature; bh=bE6uuGdWe7OQu2ZGa3bluS9TB8TgYWGKO8bHIpTd7sY=; b=fhGeb+JFjZrwZxPZOBUE2xsNjmAww7o+U+7Neg7lb1mNxi8rsl+ZtgaeuyMGP1DEo/ bQFVUq7KM+htkuOMPv196J+R3OYtXdpZvRbWvpf+APBRp6p9281L1lcGuf8jKm5nRjaz nwvojacBGrdS97XPn0i9VpL8lnu25B6muonb+BFYjNIbpjOx/u/ELLeWzCwxNqSoE9jB gW0aoS4ubCGBXqpZ+jIYyrvlw782hvkwdPm+8kDXWfw739lNt4wU+Oja2GNZ2AsJLU+i QpstNPAZwFj3r53Ov9BLlTtUsoJF7UVke9+6bHLaYcXJUhI2S1JOII97jpr6cUcPb8LR tu6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=TrllTA33; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si1059995ejy.58.2020.07.15.05.04.26; Wed, 15 Jul 2020 05:04:51 -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; dkim=fail header.i=@microchip.com header.s=mchp header.b=TrllTA33; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729971AbgGOLYz (ORCPT + 99 others); Wed, 15 Jul 2020 07:24:55 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:62426 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729938AbgGOLYz (ORCPT ); Wed, 15 Jul 2020 07:24:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1594812294; x=1626348294; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Zj8y6PhZEdQjJEh+6pVcK105guGzemj0ylKCAe8Ysco=; b=TrllTA33oR89kpATk8Jo51oguyd9LeORHW64Fd2vLZSVdtKSyUZ4E3WK We+xCH9ySeXFTOweoF3wRqxCWEeqgexLkMfZC9hz/8y2FhISx12PsaOp2 PYQSVI2YhjNuXx05mJUyaNr1+Q/q760KkXqLGKFNCv8Ym5GtUBGPpYiR8 wJWja3A1OGy5d0x47CWmfuQcIH0sRZwrABqG/WuCEkYF/yLixoF3sHWgn bM8AluP1k+9mM0SDcpTqWY75B98+Q9pTMV9ruZ59CPf0UAqvPHnEDwd1G aL/XBVbTAexK8nb0p8oOk8sZ4bbCS70dgBDuMBLOhTwJJinIfOCYb65H9 A==; IronPort-SDR: bWiHJ2HU/50IaNHpFnA5JKHNpjvKB1JTRViO+douwV1WcHubhVIk+7xHstLhqaKG9RdjZp1cya UJ//y4IfgAbg4xKnTqTnxS/n115Fk2EijHQUiWw0YAOFJttH9E1Rc4n1mieNpFnQ+7V+xS2L9w 1QD4WHCwllLp4SyecIeIKpxVVaptOPrVndawPfadiCQd+18T3bt+VtN3fy3vORBUepGfxWCjlV e5/L4DMvf+UIspcKRXKB3ZSWXaeRHGRS8mGf3Zge1PTC0BGX21HIKkKc20BuWuvGEBnu9cEGBv ZNw= X-IronPort-AV: E=Sophos;i="5.75,355,1589266800"; d="scan'208";a="83962806" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Jul 2020 04:24:53 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 15 Jul 2020 04:24:53 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 15 Jul 2020 04:24:17 -0700 From: Claudiu Beznea To: , , , , CC: , , , , "Claudiu Beznea" Subject: [PATCH 05/19] clk: at91: sam9x60-pll: use logical or for range check Date: Wed, 15 Jul 2020 14:24:13 +0300 Message-ID: <1594812267-6697-6-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594812267-6697-1-git-send-email-claudiu.beznea@microchip.com> References: <1594812267-6697-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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