git: 5b616dafacfa - main - Fix set but not used warnings in arm64 core code

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

URL: https://cgit.FreeBSD.org/src/commit/?id=5b616dafacfa249cf5b88d19fa1746c15e5e9a84

commit 5b616dafacfa249cf5b88d19fa1746c15e5e9a84
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2021-12-10 12:06:25 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2021-12-10 12:10:30 +0000

    Fix set but not used warnings in arm64 core code
---
 sys/arm64/arm64/busdma_bounce.c     | 8 +++++++-
 sys/arm64/arm64/elf32_machdep.c     | 2 ++
 sys/arm64/arm64/exec_machdep.c      | 2 --
 sys/arm64/arm64/freebsd32_machdep.c | 4 ----
 sys/arm64/arm64/gic_v3.c            | 4 ----
 sys/arm64/arm64/gicv3_its.c         | 4 ----
 sys/arm64/arm64/mp_machdep.c        | 2 --
 7 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/sys/arm64/arm64/busdma_bounce.c b/sys/arm64/arm64/busdma_bounce.c
index d2e63d7b72d8..b2d00b9c0abd 100644
--- a/sys/arm64/arm64/busdma_bounce.c
+++ b/sys/arm64/arm64/busdma_bounce.c
@@ -338,11 +338,17 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
 static int
 bounce_bus_dma_tag_destroy(bus_dma_tag_t dmat)
 {
-	bus_dma_tag_t dmat_copy, parent;
+#ifdef KTR
+	bus_dma_tag_t dmat_copy;
+#endif
+	bus_dma_tag_t parent;
 	int error;
 
 	error = 0;
+#ifdef KTR
 	dmat_copy = dmat;
+#endif
+
 
 	if (dmat != NULL) {
 		if (dmat->map_count != 0) {
diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c
index ec1afd2d7b3e..c528de5c2e62 100644
--- a/sys/arm64/arm64/elf32_machdep.c
+++ b/sys/arm64/arm64/elf32_machdep.c
@@ -204,6 +204,8 @@ freebsd32_fetch_syscall_args(struct thread *td)
 			panic("Too many system call arguiments");
 		error = copyin((void *)td->td_frame->tf_x[13], args,
 		    (narg - nap) * sizeof(int));
+		if (error != 0)
+			return (error);
 		for (i = 0; i < (narg - nap); i++)
 			sa->args[i + nap] = args[i];
 	}
diff --git a/sys/arm64/arm64/exec_machdep.c b/sys/arm64/arm64/exec_machdep.c
index 25fd9401df8c..b4ac8887ab72 100644
--- a/sys/arm64/arm64/exec_machdep.c
+++ b/sys/arm64/arm64/exec_machdep.c
@@ -211,11 +211,9 @@ set_dbregs(struct thread *td, struct dbreg *regs)
 	struct debug_monitor_state *monitor;
 	uint64_t addr;
 	uint32_t ctrl;
-	int count;
 	int i;
 
 	monitor = &td->td_pcb->pcb_dbg_regs;
-	count = 0;
 	monitor->dbg_enable_count = 0;
 
 	for (i = 0; i < DBG_BRP_MAX; i++) {
diff --git a/sys/arm64/arm64/freebsd32_machdep.c b/sys/arm64/arm64/freebsd32_machdep.c
index cab778747113..81b4ef9ebedb 100644
--- a/sys/arm64/arm64/freebsd32_machdep.c
+++ b/sys/arm64/arm64/freebsd32_machdep.c
@@ -165,11 +165,9 @@ set_fpcontext32(struct thread *td, mcontext32_vfp_t *mcp)
 static void
 get_mcontext32(struct thread *td, mcontext32_t *mcp, int flags)
 {
-	struct pcb *pcb;
 	struct trapframe *tf;
 	int i;
 
-	pcb = td->td_pcb;
 	tf = td->td_frame;
 
 	if ((flags & GET_MC_CLEAR_RET) != 0) {
@@ -315,14 +313,12 @@ freebsd32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
 	struct sysentvec *sysent;
 	int onstack;
 	int sig;
-	int code;
 
 	siginfo_to_siginfo32(&ksi->ksi_info, &siginfo);
 	td = curthread;
 	p = td->td_proc;
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 	sig = ksi->ksi_signo;
-	code = ksi->ksi_code;
 	psp = p->p_sigacts;
 	mtx_assert(&psp->ps_mtx, MA_OWNED);
 	tf = td->td_frame;
diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c
index 7d9160f8ae17..27f41c58fe92 100644
--- a/sys/arm64/arm64/gic_v3.c
+++ b/sys/arm64/arm64/gic_v3.c
@@ -489,10 +489,6 @@ gic_v3_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
 static int
 gic_v3_write_ivar(device_t dev, device_t child, int which, uintptr_t value)
 {
-	struct gic_v3_softc *sc;
-
-	sc = device_get_softc(dev);
-
 	switch(which) {
 	case GICV3_IVAR_NIRQS:
 	case GICV3_IVAR_REDIST:
diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c
index 0f30ca746e9e..516cfbd9e358 100644
--- a/sys/arm64/arm64/gicv3_its.c
+++ b/sys/arm64/arm64/gicv3_its.c
@@ -1025,9 +1025,7 @@ static void
 gicv3_its_pre_ithread(device_t dev, struct intr_irqsrc *isrc)
 {
 	struct gicv3_its_irqsrc *girq;
-	struct gicv3_its_softc *sc;
 
-	sc = device_get_softc(dev);
 	girq = (struct gicv3_its_irqsrc *)isrc;
 	gic_icc_write(EOIR1, girq->gi_lpi + GIC_FIRST_LPI);
 }
@@ -1042,9 +1040,7 @@ static void
 gicv3_its_post_filter(device_t dev, struct intr_irqsrc *isrc)
 {
 	struct gicv3_its_irqsrc *girq;
-	struct gicv3_its_softc *sc;
 
-	sc = device_get_softc(dev);
 	girq = (struct gicv3_its_irqsrc *)isrc;
 	gic_icc_write(EOIR1, girq->gi_lpi + GIC_FIRST_LPI);
 }
diff --git a/sys/arm64/arm64/mp_machdep.c b/sys/arm64/arm64/mp_machdep.c
index 4eebfe219934..05e8c8efe5b4 100644
--- a/sys/arm64/arm64/mp_machdep.c
+++ b/sys/arm64/arm64/mp_machdep.c
@@ -710,12 +710,10 @@ cpu_mp_announce(void)
 static void
 cpu_count_acpi_handler(ACPI_SUBTABLE_HEADER *entry, void *arg)
 {
-	ACPI_MADT_GENERIC_INTERRUPT *intr;
 	u_int *cores = arg;
 
 	switch(entry->Type) {
 	case ACPI_MADT_TYPE_GENERIC_INTERRUPT:
-		intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry;
 		(*cores)++;
 		break;
 	default: