git: 2b556942cc29 - main - Fix set but not used warnings in arm64 rockchip

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Fri, 10 Dec 2021 13:32:12 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=2b556942cc29dcbf1d85cc6342696e2f7168c067

commit 2b556942cc29dcbf1d85cc6342696e2f7168c067
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2021-12-10 12:23:21 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2021-12-10 13:29:11 +0000

    Fix set but not used warnings in arm64 rockchip
    
    Reviewed by:    manu, mmel
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D33372
---
 sys/arm64/rockchip/clk/rk_clk_composite.c | 2 +-
 sys/arm64/rockchip/clk/rk_clk_pll.c       | 7 -------
 sys/arm64/rockchip/rk_i2s.c               | 5 +++--
 sys/arm64/rockchip/rk_pinctrl.c           | 3 +--
 4 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/sys/arm64/rockchip/clk/rk_clk_composite.c b/sys/arm64/rockchip/clk/rk_clk_composite.c
index 17d258e02985..b6d1621a0eac 100644
--- a/sys/arm64/rockchip/clk/rk_clk_composite.c
+++ b/sys/arm64/rockchip/clk/rk_clk_composite.c
@@ -247,7 +247,7 @@ rk_clk_composite_find_best(struct rk_clk_composite_sc *sc, uint64_t fparent,
 			break;
 		}
 	}
-	*reg = div_reg;
+	*reg = best_div_reg;
 	return (best_div);
 }
 
diff --git a/sys/arm64/rockchip/clk/rk_clk_pll.c b/sys/arm64/rockchip/clk/rk_clk_pll.c
index 99026c546727..4327735f401d 100644
--- a/sys/arm64/rockchip/clk/rk_clk_pll.c
+++ b/sys/arm64/rockchip/clk/rk_clk_pll.c
@@ -373,10 +373,6 @@ rk3066_clk_pll_register(struct clkdom *clkdom, struct rk_clk_pll_def *clkdef)
 static int
 rk3328_clk_pll_init(struct clknode *clk, device_t dev)
 {
-	struct rk_clk_pll_sc *sc;
-
-	sc = clknode_get_softc(clk);
-
 	clknode_init_parent_idx(clk, 0);
 
 	return (0);
@@ -585,9 +581,6 @@ rk3328_clk_pll_register(struct clkdom *clkdom, struct rk_clk_pll_def *clkdef)
 static int
 rk3399_clk_pll_init(struct clknode *clk, device_t dev)
 {
-	struct rk_clk_pll_sc *sc;
-
-	sc = clknode_get_softc(clk);
 	clknode_init_parent_idx(clk, 0);
 
 	return (0);
diff --git a/sys/arm64/rockchip/rk_i2s.c b/sys/arm64/rockchip/rk_i2s.c
index 52f80789a795..450c2c6e2b77 100644
--- a/sys/arm64/rockchip/rk_i2s.c
+++ b/sys/arm64/rockchip/rk_i2s.c
@@ -404,13 +404,14 @@ rk_i2s_dai_intr(device_t dev, struct snd_dbuf *play_buf, struct snd_dbuf *rec_bu
 		uint8_t *samples;
 		uint32_t count, size, readyptr, written;
 		count = sndbuf_getready(play_buf);
+		if (count > FIFO_SIZE - 1)
+			count = FIFO_SIZE - 1;
 		size = sndbuf_getsize(play_buf);
 		readyptr = sndbuf_getreadyptr(play_buf);
 
-		/* FIXME: check actual count size */
 		samples = (uint8_t*)sndbuf_getbuf(play_buf);
 		written = 0;
-		for (; level < FIFO_SIZE - 1; level++) {
+		for (; level < count; level++) {
 			val  = (samples[readyptr++ % size] << 0);
 			val |= (samples[readyptr++ % size] << 8);
 			val |= (samples[readyptr++ % size] << 16);
diff --git a/sys/arm64/rockchip/rk_pinctrl.c b/sys/arm64/rockchip/rk_pinctrl.c
index 24ad7798eef0..21ab984aca5a 100644
--- a/sys/arm64/rockchip/rk_pinctrl.c
+++ b/sys/arm64/rockchip/rk_pinctrl.c
@@ -1117,7 +1117,7 @@ rk_pinctrl_get_flags(device_t pinctrl, device_t gpio, uint32_t pin,
 {
 	struct rk_pinctrl_softc *sc;
 	struct syscon *syscon;
-	uint32_t reg, mask, bit;
+	uint32_t reg, bit;
 	uint32_t bias;
 	int bank;
 	int rv = 0;
@@ -1141,7 +1141,6 @@ rk_pinctrl_get_flags(device_t pinctrl, device_t gpio, uint32_t pin,
 	reg = sc->conf->get_pd_offset(sc, bank);
 	reg += bank * 0x10 + ((pin / 8) * 0x4);
 	bit = (pin % 8) * 2;
-	mask = (0x3 << bit) << 16;
 	reg = SYSCON_READ_4(syscon, reg);
 	reg = (reg >> bit) & 0x3;
 	bias = sc->conf->resolv_bias_value(bank, reg);