From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796453932; b=awFe7DnnkdRlzClrU8J+ie9vYIpyHirJtBQQhcpIKWacRORxeWVDg6zNaTZuUOBjpVNl aBW6PXH27ZieeJDfbXxK1ft1ZmxrldykL2Xbo6wCwcuv3gGRPZnVrPN4TZqf3H/duykBv 6zUnlh5ePnipiOUNq10J4tS4h3HHwxFwRDr6No+4zFNWR9lHoUj/gzSk9kwjg9HCqVxBl jISc0+u9yV0tI/5QOjhOihefiaamX2hlGMf6P586m1Do9YQvnT130RZ1OH8nsQEfI/kcL dBmSXkUZMf1LrJcf6sNBD7FSGFNY9sNL+b/Wd8ki6lzC6FFJrPQnyLOcV5aCh3hwctQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796453932; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=629ia/xO6tLX/DFr+mAs170iHXapp2t9lKcU2zyVyR8=; b=ewMHAolUXt44QMiDinU9eo6akr4oLKNnONpU0XLgcY17qXsOAJUV1OVmPzC/lgdAfWQE b5ty7/AnFkJSLdhKnSzOon1cjJt5V9PCCcvg018AkvYo7XypQ2h5X0dcvyADHMoVVi9M3 zOEN0n/PZSFlrrAPehNg0XvFO7YGsTK3AVd/28FkoXQspt+pANCncsQPu4AK1+JQy1wRn QZBsB+FcgYEVcjnNzMjz/ipEOt77e716vqLZr7PL8g9oZr2EAMEvsRyFNEBEt/4MrthbL IqiGliS8dL5HYAas2SBCHz3Djvfq+j/gyOPdI/JS4GK0HMtQjekr9a/L0d3roBj6HKg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="RN0+/P+q"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53693606A322 for ; Sat, 5 Dec 2026 06:58:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=RN0+/P+q Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCDD41F00A07; Sat, 5 Dec 2026 06:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796453932; bh=629ia/xO6tLX/DFr+mAs170iHXapp2t9lKcU2zyVyR8=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=RN0+/P+qW1FeAbEQyaTbro0T9IUkoc3hMZyofKrFzcLboskoRigdAhNNiGWaE4X2h L88GzCx1bPT8zKbOKP0Wo5gyfSEraxVR++SIjb9rTTPGhnJFRZnbPA0f9aTmMVRBXO 2jvd+JRcCJTORB9WPPbwvKX6WY57lx8keaUFDoODsHOcRHWd7YP4tYDAa2Bju6BjpZ RmYa5MO5IZba8qbBWwwv0jB6a/DWPZ6ndpyhgl8gLGbxCHoueyH/IIgXeXrOYkyddV ADKJ1I4dskPYD+1JBUEkzuOCB7UjgACRN9gdwPGQvyj/bEl3YAzzQDo0FAkrnbDmgr Inous7HiWA5tg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] clk: rockchip: Skip PLL lock wait when GRF regmap is unavailable Reply-To: sashiko-reviews@lists.linux.dev To: "Praneeth Balasubramanian" Cc: linux-clk@vger.kernel.org In-Reply-To: <20261205064016.2525825-1-praneethb2002@gmail.com> References: <20261205064016.2525825-1-praneethb2002@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 06:58:51 +0000 X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [Medium] clk: rockchip: rockchip_pll_wait_lock() skips lock delay when GRF is missing - [Low] clk: rockchip: stale comment above rockchip_pll_wait_lock() - [Low] clk: rockchip: Fixes tag cites 90c590254051 instead of 9be83448951a - [Low] clk: rockchip: inaccurate function name and DT claim in commit message -- commit d3bc6bdc7581ec5ff20f428e879a18138c494ca0 Author: Praneeth Balasubramanian > clk: rockchip: Skip PLL lock wait when GRF regmap is unavailable > > When the DT node for a CRU has no rockchip,grf phandle, > syscon_regmap_lookup_by_phandle() stores an error pointer in ctx->grf. > For rk3066-type PLLs the registration code then selects the no-rate ops. > Those ops still install the .enable callback. rockchip_pll_enable() > calls rockchip_pll_wait_lock(), which passes the error pointer to > regmap_read_poll_timeout(). > > The only way to reach this state is a DT error, so the harm is limited > to robustness against a broken DT. Add an IS_ERR() check on the GRF > regmap in rockchip_pll_wait_lock() and return 0 when it is missing. > Without the GRF the lock bit cannot be polled, so the PLL is assumed to > lock after the powerdown bit is cleared. The set_rate path that also > uses the GRF is already excluded by the ops selection. [Severity: Low] Two small inaccuracies in the commit description: the callback is named rockchip_rk3066_pll_enable(), not rockchip_pll_enable(). Also, omitting rockchip,grf is not a DT error: the RK3188, RK3288, and RK3368 CRU bindings all list rockchip,grf as optional, so a schema-valid DT can hit this path at boot. > This was found by an LLM-based audit that checks code against the rules > stated in kernel comments. > > Fixes: 90c590254051 ("clk: rockchip: add clock type for pll clocks and pl= l used on rk3066") > Cc: stable@vger.kernel.org > Signed-off-by: Praneeth Balasubramanian [Severity: Low] Should this Fixes: tag cite 9be83448951a ("clk: rockchip: add pll_wait_lock for pll_enable") instead? In 90c590254051 ("clk: rockchip: add clock type for pll clocks and pll used on rk3066"), rockchip_pll_wait_lock() was only called from rockchip_rk3066_pll_set_rate() after checking IS_ERR(grf); 9be83448951a ("clk: rockchip: add pll_wait_lock for pll_enable") added the unguarded call in rockchip_rk3066_pll_enable(). > diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pl= l.c > index d371c66800df6..88bced1915e6b 100644 > --- a/drivers/clk/rockchip/clk-pll.c > +++ b/drivers/clk/rockchip/clk-pll.c > @@ -95,6 +95,9 @@ static int rockchip_pll_wait_lock(struct rockchip_clk_p= ll *pll) > unsigned int val; > int ret; > =20 > + if (IS_ERR(grf)) > + return 0; [Severity: Medium] Can returning 0 immediately here let downstream consumers run on an unlocked PLL? When ctx->grf is unavailable, rockchip_rk3066_pll_clk_norate_ops still installs rockchip_rk3066_pll_enable() and rockchip_rk3066_pll_disable(). An unprotected PLL such as npll on RK3288 can be powered down via RK3066_PLLCON3_PWRDOWN when its consumers disable it; on re-enable, rockchip_rk3066_pll_enable() clears PWRDOWN and relies solely on rockchip_pll_wait_lock() to wait for stabilization, risking peripheral malfunction or bus hangs if the clock is used before lock. Consider either waiting a conservative fixed delay when grf is unavailable or omitting .enable/.disable when IS_ERR(ctx->grf) so PLLs are not powered down without a lock check. [Severity: Low] The comment immediately above rockchip_pll_wait_lock() now contradicts this change: drivers/clk/rockchip/clk-pll.c (above rockchip_pll_wait_lock()): /* * Wait for the pll to reach the locked state. * The calling set_rate function is responsible for making sure the * grf regmap is available. */ Because rockchip_pll_wait_lock() now handles IS_ERR(grf) directly and is also called by rockchip_rk3066_pll_enable(), this comment should be updated to reflect the actual contract when GRF is unavailable. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205064016.2525= 825-1-praneethb2002@gmail.com?part=3D1