From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.52 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796452827; b=hxoQuBp4SCDhPDftUU9InaZc4Z1AOjKoMEzFVTYWT/wqc7Wm01RoskhMoucYsXCrpoRn jo9FpnsKq2NopyNbMyfIWvKKDcpPuM+lYOwl3fIbs7iUHhELAFR6+Q7anR1HbOd4B3W7/ HQwvi2yS5dmimdOTw0NK/dWH0wudiBhlACL4qSJqBFBJj9vPzfQYjdpF3DRLohRAaFTK4 DUkDAbh270Ee5pqw4oOxaieCEaik1MvlrPh+8YEWIc6jdv3FkjDLOqow55/vP+gud0Ki7 UrxbSoDgz1EjGUf70kWnB4/OeVwavQETIGMWEpfkVLYySX3X7gBvmpMDCOH/6BqbqBg== 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=Kq7dP8oLTqCQQ1xCvyXiF1ZbvrP7qjZ8BjW1/Rl4FZmCe5ojmwY/4Bq5mdKEBwBgW836 2cXYJhIU1nlZStP6GD8MP1BsbngZbRJFlmUoWHMw7ZFmRCFJIs+M4pPUC0a4YE5lMivuk Bh9RKnF4GLWUVv/AcbMj+F/KqXO1mE7z0UjTG8S+8uIfmPnw+STOSAksBXMU6ZAwVdgfA P7HH4hMlRTGP8ZrnRAAU43mrx9ob4scx1W5LmJMKqcGLiI199XQ3RZvLVsxDsIwB9GVPQ ndUnEVp09BRh/EhKzzWb56W1ceLQ4IhtBaVgnG+94BgzVRLDZRUsFVSvoCj1pXz4v1w== 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.52 Received: from mail-dl1-f52.google.com (mail-dl1-f52.google.com [74.125.82.52]) (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 C9F0F606A330 for ; Sat, 5 Dec 2026 06:40:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C9F0F606A330 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-dl1-f52.google.com with SMTP id a92af1059eb24-1b546061d58so3882955c88.1 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=NoDxawidA8BVXuQKRwTIsV6DoNdmiCwM6AMVvwcfrzC4nbC7xS80DRsruvvwmQktta 8bEHcqvl0xWauBJO61+hRj73ZTBUYsVc3Wkw5y9X2PyWpn8B+4PpUwgluIDMxSXDA+7/ hlhDZC+Ebiygvz8y3M0GsMhqnxhknde265YYacRnmQPs76CKr/3y6TmYCFrrvKtfrJCt SSL2bTFzpdQyxGX30Y4OFtIjyZVjo6E4KD7XA1f9XQd3KTDnBiAivKJf8057cGvsvmM5 eyLnfqr9mSNtBXmfYJtP3Cc1fIZZUbMFERWHighaPLCW0POuwMNSNYERFykJK3NhhA0m eqYw== X-Forwarded-Encrypted: i=1; AL+hErEiDuxGPjJsW9/T5V1z/jtq5tJg64oexzSX8c8yn89Vu+HjNDgdsKQzrqutryOVeWgGRxx0Xi8=@vger.kernel.org X-Gm-Message-State: AB4q+uFHormWfJomOgziw2jaIkL9/dRhPOVmwJ33YmikjKDqN3xsfBRq ZqM2VbX20i/nPsvWCmX1RQq9PD8T/EijrwFa8kxBmnk/BuFuA/EyTiMJ X-Gm-Gg: AZFdTZfo1YmVSIC+WGSc8hFe2U3a23sUUXfnd8cuE8MAZXmbRPemvyIbWKEjaPGNWJz GrOrUmFkL4QfrqXh7NUbPuFP7S/1twdPskiVaHaOCr+7HVrsJnmm3ZoR2HjphU6yNw2S3mOvZaf ooR8T1Kd+YK/2GO03PhUKxO18diqEFDTZGW1EddFopacKheKNtIsapjsbseZmr2ivj17DxxJ5lo T86/oIYNTAK3B27eEJzhpb9s6KF+QTRUUs7E8HtihLInq1TkZ0sLIi2q/+tCgodjpBamHO+o+Pl nGL4VmxiwYd0yEVvtoNcfYF2yXq/EBShrz+s2bJemVHDqyliF6HMXAoi1nbsCi36LY+mEum9uRB JCAEMIa5nGnm3NvafOv1nK5s0Fsfkp5cldwfOxer8oCg1fPIeQd4UYZLSlOSBP160JYJZ2LMKIu tJL2d9grf3kL65rPa78eE9hUTePiZXn6QUoYLZyF2G+KtWmjxTavg50wvwZOOAP4m4UoUycS9oY 113wl2wPuqmcTISMUewWfxSvEqtSHc/ywTjqdb1J82pDYUIIw9X+x4Urmi643wIBTlX4S5cJeO0 mta8Q2FK6DyiQhpLCXVQ41IPM/fH3/sI58MjZANQxmVvSNRSSCmNOCl+EKc2IsnAA0lx 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: stable@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