git: 3337dd483bae - main - aw_clk: Initialize best in the nmm and np find_best functions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Nov 2026 09:51:21 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=3337dd483bae129ff2dabc626bee121f6299646d
commit 3337dd483bae129ff2dabc626bee121f6299646d
Author: Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2026-11-10 14:29:25 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2026-11-12 09:47:28 +0000
aw_clk: Initialize best in the nmm and np find_best functions
aw_clk_nmm_find_best() and aw_clk_np_find_best() compared the first
candidate to best before it was ever assigned, so the result of the
search depended on whatever was on the stack. Initialize it to 0 like
the nm and nkmp ones do.
---
sys/dev/clk/allwinner/aw_clk_nmm.c | 2 +-
sys/dev/clk/allwinner/aw_clk_np.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/dev/clk/allwinner/aw_clk_nmm.c b/sys/dev/clk/allwinner/aw_clk_nmm.c
index ac55c5eea182..e8935d84acbc 100644
--- a/sys/dev/clk/allwinner/aw_clk_nmm.c
+++ b/sys/dev/clk/allwinner/aw_clk_nmm.c
@@ -101,7 +101,7 @@ static uint64_t
aw_clk_nmm_find_best(struct aw_clk_nmm_sc *sc, uint64_t fparent, uint64_t *fout,
uint32_t *factor_n, uint32_t *factor_m0, uint32_t *factor_m1)
{
- uint64_t cur, best;
+ uint64_t cur, best = 0;
uint32_t n, m0, m1;
uint32_t max_n, max_m0, max_m1;
uint32_t min_n, min_m0, min_m1;
diff --git a/sys/dev/clk/allwinner/aw_clk_np.c b/sys/dev/clk/allwinner/aw_clk_np.c
index bca81eb3e937..9c55063552ed 100644
--- a/sys/dev/clk/allwinner/aw_clk_np.c
+++ b/sys/dev/clk/allwinner/aw_clk_np.c
@@ -100,7 +100,7 @@ static uint64_t
aw_clk_np_find_best(struct aw_clk_np_sc *sc, uint64_t fparent, uint64_t *fout,
uint32_t *factor_n, uint32_t *factor_p)
{
- uint64_t cur, best;
+ uint64_t cur, best = 0;
uint32_t n, p, max_n, max_p, min_n, min_p;
*factor_n = *factor_p = 0;