From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.171 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796452827; b=SIECDeDB6LbyTeYqaQUDK4IS1VxZabue/w0U7pOtUTYhyIYpA6XGFYu2pxtF3jFC0ko1 OyxPv2LFJWtDZehpa+bkhDG+QjLzRrfZ8avt5GI/OC7S9boEPnTTNRdIrT7/i3JGCOUtT r0KK1IGNX3BdHSEJk26qkDqXw8jdGZBHOg7JJ22f/x+srRkuQ2joNQHwweWolGYvcQimH UoFaFBfczkDzwyFddYRNkJqIajrkTHlC1xN9+sKpxwjF1FgFJs1lyUgF0mgqemPaYrfP9 XltLU/IxiAuoMOXdB6i8dMxWCOd8n7YmIQAGtG+KABSEkl8SibLtbqsgnGe7RYcL15g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796452827; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=BWxhzDUuEapzHv348rvIIcraL6BsUm2/pbowmnBmNME=; b=QA2XzxpGIR0GTEy/k9rD5sd+U8ic1SfaS5XRRJy8TEjrjJx+0pM/5pvFqKIA2uMilwkJ AP73LCqInzmSmCs2IsU5WNUtjAxfFq18/5S54yU2evte5sc9LRnQeAMnd8eXVMrz4Sy5f LQaqodt05Ay0rSAzdXySOZd/yvrYIarDScoN2YnkH41HowDSht17ZTfvjMt+3GY9/+DJX SyArsMCg9fUqDLQzFziKmnJq4Af0k2tralr+Gy+G27hLBqsHpAcD1ruhrbVnywvu1WpPb ikB99ALhURiQaKhBu2k+gtt3pZlb/mnggEUVer0B0bqu2KqqT5J74kaekLWaPj35xOw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Gq988Nbb; arc=none smtp.remote-ip=74.125.82.171 Received: from mail-dy1-f171.google.com (mail-dy1-f171.google.com [74.125.82.171]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC8C6606A322 for ; Sat, 5 Dec 2026 06:40:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BC8C6606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Gq988Nbb Received: by mail-dy1-f171.google.com with SMTP id 5a478bee46e88-33bf40b0c8bso3781987eec.0 for ; Fri, 04 Dec 2026 22:40:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796452826; x=1797057626; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=BWxhzDUuEapzHv348rvIIcraL6BsUm2/pbowmnBmNME=; b=Gq988Nbb1Ix3Bx2A/9PH8MWOZ1RupAk5JUqrbufGTzrvpIUN4/OqVVEyh5qQa+Ib69 +tXuyNnJ3unpzi/+UE0dHIC71cD11VblPb+8HS1BmbxQLOSTNzsJZr1mcAXSCs+ZpzWp PAXi/76/efd/TQPnmVKo2GYqj7ukoBkOYIuvGj7rqfHQ46vzcl51GuJZfbhGsNRFHuRq Sda1oyNHLsy9sXVK9Imx8vJoDS42BRITY9ImFHBQFte+TB2CZrJPmVMHJSorwzkqWhrW wa1xtip6tHMNeyXPzwpF+dqJtlek2qcMx9x6uK/bXi+sH9B+4U2NB8/eubFTSV05nD7f 91uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796452826; x=1797057626; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=BWxhzDUuEapzHv348rvIIcraL6BsUm2/pbowmnBmNME=; b=HxdjhVbvXyO6Bwnyav1IFZI3UbOTIlxS6zDMDSeEWLmGn3CqEM/GzDW8uhTVEE0KBD QV08dAN0bugzWf4CNMNCdmQZZXBRYwQ8fuMRTlE/m+5KNevenUp2CzPsodaq1lhvQbci FEcJ6NfF6io058UF7v/BxpfTzf15RARNQCGegJWJDCxXHqnuFCOgC1O3di9ISzj09usw CkthDXx7f50hSBY8SPdEdnFXXoEsaHiQaRs3RWGt4fNLBYFA5u6uqvHj7Akw4fW6O7CE dBRUPUp76zRbg3GJAVFcfFetufvHTztrYCblXusdw1m44Dq0TsFVCqPbBNLQHZ8rirkS MfuA== X-Forwarded-Encrypted: i=1; AL+hErEQiI0gpGF8gUnXk3q6ZXRXB3KD2Azy6pH4hgH8cHvsAINqH7Litn0tbdZlqPi+Owh07H1TFNZypSQFcOM=@vger.kernel.org X-Gm-Message-State: AB4q+uHOSaXeZ/yNqW/5ljce2IIA5aSnf3OxY2iqif9ZWfLv/cmkyb0P floD2tTjCfGL5dYoieZjIszFyjpS3F+GKHe00EJCjOq97bTSD7OrGCgv X-Gm-Gg: AZFdTZf53Tt/R78NaAC81S4ZCTIN/6Ep45kYt54NHkDmGMwus65b2CmMUeX9e2f3GxK hsNApXB5aKaprE4e7//zoDQwcvMsI7rydzJKHRGSl88jtUuVJ02kUbzM6mFdJES91aksCFZsuHv Mx7aAX981/oA5C0J4+s7y9FQfVQLKMy+PQZa7e78AcZL8xPZ8waouogEzrA9Ss7tlAq9t4sbQmn KcqL0DfiBeq5kY2PYtfDJsknHxxA4EpI7+oZO80TVO1AoODuK1t2ZqlyPqp84bOjZeD3DD3CK8j mptCCR8bPcCBp8yjOdJIys45QPSrJU2dEyBi+UkBmel67wNeZTFPx6r1pTFtBO1MQFv5+UrshKg N6CF3tXXN+HdFVg54Z2ISjdjHKcuOZL6UIAFWainsYOModr6TwFQ6/JC20E/ACWLjE0HJ9Iduft Qfr3kBhibM+z2BWhbpLUyeUcrtV7IIbO0Rhikb9peqqePQd9WjuRVvleHkXMyMRj8Tuki4QnbJu r2qLlyD+j8/GxEnqa/wMBEg9kC8WxADzKZThq6MX9DqE73oSDrTxgczVTNhG1oEZrqUE9cy9kNU +hr88xzST15vUhQc+SuOoAtXSGEgziQ3eYc/nqBUS5bCF/A8sqw6tNm9ftLclZHMDosr X-Received: by 2002:a05:7301:d805:b0:36d:3c0f:cc6f with SMTP id 5a478bee46e88-38751fc94b6mr4240814eec.3.1796452825882; Fri, 04 Dec 2026 22:40:25 -0800 (PST) Received: from localhost.localdomain (wood.seclab.cs.ucsb.edu. [128.111.49.37]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3875221a4a3sm14766308eec.24.2026.12.04.22.40.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 22:40:25 -0800 (PST) From: Praneeth Balasubramanian To: Stephen Boyd , Brian Masney , Jerome Brunet , Heiko Stuebner Cc: Praneeth Balasubramanian , stable@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] clk: rockchip: Skip PLL lock wait when GRF regmap is unavailable Date: Fri, 4 Dec 2026 22:40:16 -0800 Message-Id: <20261205064016.2525825-1-praneethb2002@gmail.com> X-Mailer: git-send-email 2.25.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. 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 pll used on rk3066") Cc: stable@vger.kernel.org Signed-off-by: Praneeth Balasubramanian --- Notes: This was found by an LLM-based audit, part of research at UCSB SecLab. An LLM turned a kernel comment into a rule, and three LLM votes checked the code against it. The fix and changelog were drafted with GLM-5.3 and checked against the source with Claude Opus 5.5. I reviewed the patch and take responsibility for it. Testing: builds without new warnings with W=1 (x86_64 allmodconfig), clang 23. checkpatch.pl is clean. Not runtime-tested, and there is no reproducer. I do not have this hardware. drivers/clk/rockchip/clk-pll.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c index d371c66800df..88bced1915e6 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_pll *pll) unsigned int val; int ret; + if (IS_ERR(grf)) + return 0; + ret = regmap_read_poll_timeout(grf, pll->lock_offset, val, val & BIT(pll->lock_shift), 0, 1000); if (ret) base-commit: 29beb21c21ada7207692b2d69fc58dcd15dab6e9 -- 2.25.1