* Re: [PATCH][next] clk: sunxi-ng: nkm: remove redundant initialization of tmp_parent
2023-10-23 13:35 [PATCH][next] clk: sunxi-ng: nkm: remove redundant initialization of tmp_parent Colin Ian King
@ 2023-10-23 13:52 ` Andre Przywara
2023-10-23 21:28 ` Jernej Škrabec
2023-11-18 22:21 ` Jernej Škrabec
2 siblings, 0 replies; 4+ messages in thread
From: Andre Przywara @ 2023-10-23 13:52 UTC (permalink / raw)
To: Colin Ian King
Cc: Michael Turquette, Stephen Boyd, Chen-Yu Tsai, Jernej Skrabec,
Samuel Holland, linux-clk, linux-arm-kernel, linux-sunxi,
linux-kernel, kernel-janitors
On Mon, 23 Oct 2023 14:35:02 +0100
Colin Ian King <colin.i.king@gmail.com> wrote:
Hi,
> 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>
Yes, that seems to be correct:
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Cheers,
Andre
> ---
> drivers/clk/sunxi-ng/ccu_nkm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c
> index eed64547ad42..853f84398e2b 100644
> --- a/drivers/clk/sunxi-ng/ccu_nkm.c
> +++ b/drivers/clk/sunxi-ng/ccu_nkm.c
> @@ -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) ||
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH][next] clk: sunxi-ng: nkm: remove redundant initialization of tmp_parent
2023-10-23 13:35 [PATCH][next] clk: sunxi-ng: nkm: remove redundant initialization of tmp_parent Colin Ian King
2023-10-23 13:52 ` Andre Przywara
@ 2023-10-23 21:28 ` Jernej Škrabec
2023-11-18 22:21 ` Jernej Škrabec
2 siblings, 0 replies; 4+ messages in thread
From: Jernej Škrabec @ 2023-10-23 21:28 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Chen-Yu Tsai, Samuel Holland,
linux-clk, linux-arm-kernel, linux-sunxi, linux-kernel,
Colin Ian King
Cc: kernel-janitors
Dne ponedeljek, 23. oktober 2023 ob 15:35:02 CEST je Colin Ian King napisal(a):
> 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: Jernej Skrabec <jernej.skrabec@gmail.com>
Best regards,
Jernej
> ---
> drivers/clk/sunxi-ng/ccu_nkm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c
> index eed64547ad42..853f84398e2b 100644
> --- a/drivers/clk/sunxi-ng/ccu_nkm.c
> +++ b/drivers/clk/sunxi-ng/ccu_nkm.c
> @@ -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) ||
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH][next] clk: sunxi-ng: nkm: remove redundant initialization of tmp_parent
2023-10-23 13:35 [PATCH][next] clk: sunxi-ng: nkm: remove redundant initialization of tmp_parent Colin Ian King
2023-10-23 13:52 ` Andre Przywara
2023-10-23 21:28 ` Jernej Škrabec
@ 2023-11-18 22:21 ` Jernej Škrabec
2 siblings, 0 replies; 4+ messages in thread
From: Jernej Škrabec @ 2023-11-18 22:21 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Chen-Yu Tsai, Samuel Holland,
linux-clk, linux-arm-kernel, linux-sunxi, linux-kernel,
Colin Ian King
Cc: kernel-janitors
Dne ponedeljek, 23. oktober 2023 ob 15:35:02 CET je Colin Ian King napisal(a):
> 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>
Applied, thanks!
Best regards,
Jernej
> ---
> drivers/clk/sunxi-ng/ccu_nkm.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c
> index eed64547ad42..853f84398e2b 100644
> --- a/drivers/clk/sunxi-ng/ccu_nkm.c
> +++ b/drivers/clk/sunxi-ng/ccu_nkm.c
> @@ -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) ||
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread