git: 6a8133e32961 - stable/13 - linux: plug set-but-not-unused vars

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Fri, 17 Jun 2022 19:38:41 UTC
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=6a8133e32961e7aeb9921f4a5ef49266ccb7693d

commit 6a8133e32961e7aeb9921f4a5ef49266ccb7693d
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-11-24 21:16:03 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:33:43 +0000

    linux: plug set-but-not-unused vars
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    
    (cherry picked from commit 74a0e24f07974b4d51c57afa7525b5f88574ad31)
---
 sys/compat/linux/linux_emul.c  | 9 +++++----
 sys/compat/linux/linux_event.c | 2 --
 sys/compat/linux/linux_misc.c  | 2 --
 sys/compat/linux/linux_mmap.c  | 2 --
 4 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/sys/compat/linux/linux_emul.c b/sys/compat/linux/linux_emul.c
index bb7ffd57be6e..eb132d97db4a 100644
--- a/sys/compat/linux/linux_emul.c
+++ b/sys/compat/linux/linux_emul.c
@@ -362,12 +362,13 @@ void
 linux_schedtail(struct thread *td)
 {
 	struct linux_emuldata *em;
-	struct proc *p;
-	int error = 0;
+#ifdef KTR
+	int error;
+#else
+	int error __unused;
+#endif
 	int *child_set_tid;
 
-	p = td->td_proc;
-
 	em = em_find(td);
 	KASSERT(em != NULL, ("linux_schedtail: thread emuldata not found.\n"));
 	child_set_tid = em->child_set_tid;
diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c
index 331732eb4234..44b1a1526e3c 100644
--- a/sys/compat/linux/linux_event.c
+++ b/sys/compat/linux/linux_event.c
@@ -615,7 +615,6 @@ linux_eventfd2(struct thread *td, struct linux_eventfd2_args *args)
 int
 linux_timerfd_create(struct thread *td, struct linux_timerfd_create_args *args)
 {
-	struct filedesc *fdp;
 	struct timerfd *tfd;
 	struct file *fp;
 	clockid_t clockid;
@@ -634,7 +633,6 @@ linux_timerfd_create(struct thread *td, struct linux_timerfd_create_args *args)
 	if ((args->flags & LINUX_TFD_CLOEXEC) != 0)
 		fflags |= O_CLOEXEC;
 
-	fdp = td->td_proc->p_fd;
 	error = falloc(td, &fp, &fd, fflags);
 	if (error != 0)
 		return (error);
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 324708e9e3c7..f4a2d3bbde4b 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1087,7 +1087,6 @@ linux_waitid(struct thread *td, struct linux_waitid_args *args)
 	siginfo_t siginfo;
 	l_siginfo_t lsi;
 	idtype_t idtype;
-	struct proc *p;
 	int error;
 
 	options = 0;
@@ -1127,7 +1126,6 @@ linux_waitid(struct thread *td, struct linux_waitid_args *args)
 			return (error);
 	}
 	if (args->info != NULL) {
-		p = td->td_proc;
 		bzero(&lsi, sizeof(lsi));
 		if (td->td_retval[0] != 0) {
 			sig = bsd_to_linux_signal(siginfo.si_signo);
diff --git a/sys/compat/linux/linux_mmap.c b/sys/compat/linux/linux_mmap.c
index f4655adcbb52..6d91bb575a62 100644
--- a/sys/compat/linux/linux_mmap.c
+++ b/sys/compat/linux/linux_mmap.c
@@ -83,14 +83,12 @@ linux_mmap_common(struct thread *td, uintptr_t addr, size_t len, int prot,
 	struct proc *p = td->td_proc;
 	struct vmspace *vms = td->td_proc->p_vmspace;
 	int bsd_flags, error;
-	struct file *fp;
 
 	LINUX_CTR6(mmap2, "0x%lx, %ld, %ld, 0x%08lx, %ld, 0x%lx",
 	    addr, len, prot, flags, fd, pos);
 
 	error = 0;
 	bsd_flags = 0;
-	fp = NULL;
 
 	/*
 	 * Linux mmap(2):