clk: Initialize max_rate in struct clk_rate_request
authorMaxime Ripard <maxime@cerno.tech>
Tue, 18 Oct 2022 13:52:58 +0000 (15:52 +0200)
committerStephen Boyd <sboyd@kernel.org>
Fri, 28 Oct 2022 00:08:41 +0000 (17:08 -0700)
Since commit b46fd8dbe8ad ("clk: Zero the clk_rate_request structure"),
the clk_core_init_rate_req() function clears the struct clk_rate_request
passed as argument.

However, the default value for max_rate isn't 0 but ULONG_MAX, and we
end up creating a clk_rate_request instance where the maximum rate is 0.

Let's initialize max_rate to ULONG_MAX properly.

Fixes: b46fd8dbe8ad ("clk: Zero the clk_rate_request structure")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v1-3-f3ef80518140@cerno.tech
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/clk.c

index eb2f9be9b9aa5be697dece9fe75bd3c06203cac7..57b83665e5c3a426a03ea542f436d68c5d0741b8 100644 (file)
@@ -1463,6 +1463,7 @@ static void clk_core_init_rate_req(struct clk_core * const core,
                return;
 
        memset(req, 0, sizeof(*req));
+       req->max_rate = ULONG_MAX;
 
        if (!core)
                return;