[PATCH 3/4] clk: Initialize max_rate in struct clk_rate_request

Maxime Ripard posted 4 patches 3 years, 5 months ago
[PATCH 3/4] clk: Initialize max_rate in struct clk_rate_request
Posted by Maxime Ripard 3 years, 5 months ago
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>
---
 drivers/clk/clk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index eb2f9be9b9aa..57b83665e5c3 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -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;

-- 
b4 0.11.0-dev-7da52
Re: [PATCH 3/4] clk: Initialize max_rate in struct clk_rate_request
Posted by Stephen Boyd 3 years, 5 months ago
Quoting Maxime Ripard (2022-10-18 06:52:58)
> 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>
> ---

Applied to clk-fixes
Re: [PATCH 3/4] clk: Initialize max_rate in struct clk_rate_request
Posted by AngeloGioacchino Del Regno 3 years, 5 months ago
Il 18/10/22 15:52, Maxime Ripard ha scritto:
> 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>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>