[PATCH 1/2] drm/nouveau/clk: don't ignore RAM clock programming errors in nvkm_pstate_prog
Francesco Magazzu <[email protected]> Mon, 27 Jul 2026 17:05:45 +0200
| Newsgroups | org.freedesktop.lists.nouveau,org.freedesktop.lists.dri-devel |
|---|---|
| Message-ID | <[email protected]> |
The RAM reclock loop discards its own return value: once the do-while exits, ram->func->tidy() runs and the function falls straight into nvkm_cstate_prog(), whose result becomes the return value regardless of whether ram->func->calc()/prog() failed. A negative ret from RAM programming is silently dropped, so a failed memory clock transition is never reported and the core clock still gets reprogrammed on top of it. Return the RAM error (after tidy() has still run) instead of falling through to the core clock path. Found by Sashiko AI review (https://sashiko.dev) while reviewing "[PATCH v2 2/4] drm/nouveau/clk: don't use the pstate cursor after the loop" ([email protected]) as a pre-existing issue. Signed-off-by: Francesco Magazzu <[email protected]> --- nvkm/subdev/clk/base.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nvkm/subdev/clk/base.c b/nvkm/subdev/clk/base.c index 44dc86b..737bec8 100644 --- a/nvkm/subdev/clk/base.c +++ b/nvkm/subdev/clk/base.c @@ -298,6 +298,8 @@ nvkm_pstate_prog(struct nvkm_clk *clk, int pstatei) ret = ram->func->prog(ram); } while (ret > 0); ram->func->tidy(ram); + if (ret < 0) + return ret; } return nvkm_cstate_prog(clk, pstate, NVKM_CLK_CSTATE_HIGHEST); -- 2.55.0