clk: sunxi-ng: nkm: remove redundant initialization of tmp_parent
authorColin Ian King <colin.i.king@gmail.com>
Mon, 23 Oct 2023 13:35:02 +0000 (14:35 +0100)
committerJernej Skrabec <jernej.skrabec@gmail.com>
Sat, 18 Nov 2023 22:20:34 +0000 (23:20 +0100)
Variable tmp_parent is being ininitialized with a value that is never
read, the initialization is redundant and can be removed. Move the
initialization and move the variable to the inner loop scope.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/r/20231023133502.666559-1-colin.i.king@gmail.com
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
drivers/clk/sunxi-ng/ccu_nkm.c

index eed6454..853f843 100644 (file)
@@ -21,17 +21,16 @@ static unsigned long ccu_nkm_find_best_with_parent_adj(struct ccu_common *common
                                                       unsigned long *parent, unsigned long rate,
                                                       struct _ccu_nkm *nkm)
 {
-       unsigned long best_rate = 0, best_parent_rate = *parent, tmp_parent = *parent;
+       unsigned long best_rate = 0, best_parent_rate = *parent;
        unsigned long best_n = 0, best_k = 0, best_m = 0;
        unsigned long _n, _k, _m;
 
        for (_k = nkm->min_k; _k <= nkm->max_k; _k++) {
                for (_n = nkm->min_n; _n <= nkm->max_n; _n++) {
                        for (_m = nkm->min_m; _m <= nkm->max_m; _m++) {
-                               unsigned long tmp_rate;
+                               unsigned long tmp_rate, tmp_parent;
 
                                tmp_parent = clk_hw_round_rate(parent_hw, rate * _m / (_n * _k));
-
                                tmp_rate = tmp_parent * _n * _k / _m;
 
                                if (ccu_is_better_rate(common, rate, tmp_rate, best_rate) ||