Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6329687rwr; Mon, 24 Apr 2023 18:28:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6dtR9n3o7EkbKyjlbS8nJhG97PKF+EwsaIp4ACQNeG+pUqYdGAP1Zj9aDTQ7RpIoNw9U/J X-Received: by 2002:a17:903:18c:b0:1a9:8ddd:8215 with SMTP id z12-20020a170903018c00b001a98ddd8215mr382466plg.4.1682386114387; Mon, 24 Apr 2023 18:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682386114; cv=none; d=google.com; s=arc-20160816; b=DAxKBaDy9mpF+RM4Yz6aMi46dzAacrOF6SfBc3zgi2s9e77W3DlIEknl4g1ls4tglC L/KIOe8ReHZp4Vo9EANmO9SqtlYhep9f9FJanNJ1WtUWfUCkOF/xwc6+TN1yx/VU77KL VaF7WK+momjoupKw2d+BIgP9b9BdJHwv7KgCXV6eKxEQ468KyaT7LmUOht/1uh8Rl4Pm va2NyR15aOAIBXioDhHJAtVYs+PAMfdl6eAPZsh9OiuX+TvCSlMVpJzb2o9IuUsvBUqj ylDjmFJvceBk+pKCbHMNxMWCuJrMJdF6zsnJIOnqoUgzvuTg7gsZT8zFyAhUkBnrUF20 6A/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:date:to:cc:from:subject:references :in-reply-to:content-transfer-encoding:mime-version:message-id :dkim-signature; bh=T7EvH2flz7r0yejnh3Y8Zgihn3vRMWwnaw/B65iiSck=; b=ShuQLYakgdxOYgg23r3TOMCIkDlNGIBzACdICyMBc3ZVwD5ov/tUTIrcML7B6IWDa1 79fHliLvLrvbAQKEH+c3blj4LJ/p8GT6WiiVa3iY0U01vKlpxQ2jIn9RYhUxFm61vOGO jpC/arOxblWKmza5zox4zQy9B+juwLa3f+sOLhnQE8pByMqIaNSlt0w84e370P1UPWSY u+VHdHaaagZRtxH3n+TqHqyaDGeLYoEk/SHIpCndu3wkU65aTaUqhiayvpPlCPcjj51p OLx+AuNEUtES2I0ciIvsYZfzUPJdVpDEMWAUaQowl4K3Kzn5S/Al3lgsvlVS87801jWW T5/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iHvBd5rs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020a170902d1ca00b0019ce4e2be99si10144229plb.193.2023.04.24.18.28.21; Mon, 24 Apr 2023 18:28:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iHvBd5rs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232445AbjDYBYv (ORCPT + 99 others); Mon, 24 Apr 2023 21:24:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232815AbjDYBYt (ORCPT ); Mon, 24 Apr 2023 21:24:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1ADBE5277; Mon, 24 Apr 2023 18:24:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 955C6621BD; Tue, 25 Apr 2023 01:24:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9DF7C433D2; Tue, 25 Apr 2023 01:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682385888; bh=T7EvH2flz7r0yejnh3Y8Zgihn3vRMWwnaw/B65iiSck=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=iHvBd5rshkoX58teEXxJFAijZbUh1+lHUlolLCKUP0WfaSf3nnbh3G0r1SVQZv3zK h/1dif6N+6qUowV/VKAT8KC92LO4vMrYL+OKwA0qjl/r+dJSM+PQl4pJ6S/BwYc7YK +5MkpD1ALO5mj/axYYg8+c6rf2yaKkmNdgHPh7HfsRSWGa12btHKS9EEkDI41sggRw xx1SkF/9AJs1FNDVijQ95siiQ3pukPpbkujJDS7hXV0pKOEyz5l+NrqlVi2/6BdxZt V6vvXqgxetVl1sAPgWQssemT375Rjch+stRV1OkP82kavTmRSUn0Ixg0A52o2fSBCS xXp9tFsrzKMMA== Message-ID: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20230421-clk-v1-1-bb503f2f2cf3@outlook.com> References: <20230421-clk-v1-1-bb503f2f2cf3@outlook.com> Subject: Re: [PATCH] clk: use ULONG_MAX as the initial value for the iteration in clk_mux_determine_rate_flags() From: Stephen Boyd Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Xiwen To: Michael Turquette , Yang Xiwen via B4 Relay , forbidden405@outlook.com Date: Mon, 24 Apr 2023 18:24:44 -0700 User-Agent: alot/0.10 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Yang Xiwen via B4 Relay (2023-04-21 08:56:38) > From: Yang Xiwen >=20 > Currently, clk_mux_determine_rate_flags() use 0 as the initial value for > selecting the best matching parent. However, this will choose a > non-existant rate(0) if the requested rate is closer to 0 than the > minimum rate the parents have. >=20 > Fix that by initializing the initial value to ULONG_MAX and treat it as a > magic number. Can you add a unit test to clk_test.c as well?