From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.47 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796452827; b=y2Go5V8NdRvXPqRxlfTumFCxpK+JZSjiumpNna4IgG69iIvscpAG1N3YM9Muh8AvTudS rxeH4lPiUye5Is89VM4DhOpEgMrHzsael9K4DmZyZ1PBFw1VjZc4Wiq8MJ0My+kLXW9Ew UMoWekXTg+Ft/jHp8V00/feOcUdOiLvzhAIp69ljq8IZ15llzPqnBnlF8/wyE8iZcdyTG cGKRaddMcDs33RJj5F2gAfHC/Oey84vIYc6dTJEveIIfpUHZCqd/6yX9wD2uMyQF3eprB GB8lQfvZIi9Y4mHoZDkYgSTejYGu1sjZxPsRYbv1I2TayuWJnGpqOmTVWZOJD9zk8Ig== 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=SodM8/Lz+MOzCkUgLIARZOOVM9t7mIqFDmq1sf0uYrQxsJDCb7kLuOdjjXKnb8paT/Ks af8qs5OIGh67ZzYri8RfiwJPeeApTwohhEmzLubDmmY3Yo+JpF0G6MbeJ8Nk7UO28KHs4 8bomqEa4u22oI2P1Pfj+dqzm6h92iKA88x21+ubq2VguBGBYNhj1UHzQvPeoyOE1Y6kY2 3mV4El381lQ26lWcho/hkfRCzVuWhHVoEiOp1kfrb5tJ9Kx5s2gY/xMoHvbfxHpfGI5SA avlFosoSniUWohUrnuEn9GlKWfSsRZyS2jgWMLKNa6nwYKC2WE4nazFgNpEn/0JVQpQ== 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.47 Received: from mail-dl1-f47.google.com (mail-dl1-f47.google.com [74.125.82.47]) (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 9BBD5606A32F for ; Sat, 5 Dec 2026 06:40:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9BBD5606A32F 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-f47.google.com with SMTP id a92af1059eb24-170135e43c7so3940497c88.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=cOzl69HNBsDyyWO5xHTQ68OYiF+yV/axSCUV5H38NnrD83IcrX6CdVKTdhw3oPaMO6 s7CaPkSe+z/Jg2HBhv+u+27flHliJp+y0eU2++w+ju8Ji94+f5BErzN+nR/f57RVGpUy +HPWxgj08wdGp7Ns2dX2E+oLbljTe9Gv1ZOU67x+avpN5cXKQPoc1LGFjXlTfZnhv3IW Tb4lyBA6vuc6KyvM0+R+pCZicKCY8uTMGNTjT3TCh/7yhkueCHvd7L0NffYpk+cwjlij k9VmQtolZe8C5WjnYaP9yrVHTQfLtMowercStJRbGfT1Spf4gD24Vg0SMB4xC9csuxjW cplQ== X-Forwarded-Encrypted: i=1; AL+hErFLTfWvrv/vrTs9LUKFFcQSwlyapTQXgrFcNesywWouKTuGVoUcBOMhCGQiS3zXzjANv7hRwfnyUdg=@vger.kernel.org X-Gm-Message-State: AB4q+uHXhZg8sgmq5z+Qe2JahKAPj/SoMOdNmKbxd7c6Hu2ahTJsUCoF IQ/38MXWOSw2rgBZoJK/LUydF1u3bZi0X0QrcU5h7nUu2Br61i0yhC6ojMYhbHNi X-Gm-Gg: AZFdTZegXp/KIsfX8s1KcCxQQXQrNyvRFPADJUWKL6Mte6Zk3yZn9OYTCaXFTCB5MWS tLbqa6WhpObCXhjKqgka+iDETFZtQEqK7mzVtii8UHEj71qljwKBImiQFInGDYLelQ/4G4fFpGP 2h66W0U9cFxIyKlCQYISvyli0TfRjW9Nzs14gtBo/TWMr62MfmRUED4snIa1xHxhdUx/MoDbYJv ykV9k2Dewn12lp8RoSzU9L8cgz1t1I48/gqBWsO+W9fA1LRq3Gp2+cxcH3kL6Q3oESO5sOFbohm dWr/nGCDSVyYnzzqF1lCie6/KefU2suXtTmEtjONFft28gqZAW8McX1lGVdMRNRA/UQdndNWGmC h9N219j88goxBus6vDALZiuJ2BrZOTw4+KqOpxheREvUaukoul3xdvJupbFyvj5ci6XHkooFH1h IhGAulekc6XiZcn03RXFJ13B6CjDsYxsUN83jEhVUNeufaqM3RTO3tk3KjmSrZePVogxN4OpdWb BA03msj5IQQJsfmsLA8rKsfEuP389yVMizBS2SwtivBiDPJlvcDLY7Ak6fj6C7mS2gYMSvlBztG owXKA2ofY32exrg5P9LEzqvjG+TeZ+t/G3amDNxLTpYYDmXDhdWmzWp/Ac4jqFw5rvcm 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-clk@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