Re: [PATCH] clk: Delete redundant logic.

From: Vladimir Zapolskiy
Date: Mon Aug 26 2024 - 05:40:53 EST


On 8/26/24 11:29, jiping huang wrote:
In fact, the local variable "best_parent_rate" saved at the function
entrance is not used later on.

It's non-obvious that the stored value is not used later on in the function,
and likely there are use-cases, when it is used.

However the very least the commit message is obviously wrong stating that the
local variable is not used later on, since the local variable is used later on.

You need a more solid justification for the change.

Signed-off-by: jiping huang <huangjiping95@xxxxxx>

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 8cca52be993f..d076939c42ab 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2295,11 +2295,6 @@ static struct clk_core *clk_calc_new_rates(struct clk_core *core,
if (IS_ERR_OR_NULL(core))
return NULL;
- /* save parent rate, if it exists */
- parent = old_parent = core->parent;
- if (parent)
- best_parent_rate = parent->rate;
-
clk_core_get_boundaries(core, &min_rate, &max_rate);
/* find the closest rate and parent clk/rate */

--
Best wishes,
Vladimir