summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-02-26 15:51:54 +0000
committered <ed@FreeBSD.org>2009-02-26 15:51:54 +0000
commitb3ddcfe1f75495bb47bf5eaba6333e4822eadae7 (patch)
treed89376ead0217f0b0f64e8d12308efc93860e35a /sys
parentfb70a002f2760a40274da9dacaa3edd815884665 (diff)
downloadFreeBSD-src-b3ddcfe1f75495bb47bf5eaba6333e4822eadae7.zip
FreeBSD-src-b3ddcfe1f75495bb47bf5eaba6333e4822eadae7.tar.gz
Remove even more unneeded variable assignments.
kern_time.c: - Unused variable `p'. kern_thr.c: - Variable `error' is always caught immediately, so no reason to initialize it. There is no way that error != 0 at the end of create_thread(). kern_sig.c: - Unused variable `code'. kern_synch.c: - `rval' is always assigned in all different cases. kern_rwlock.c: - `v' is always overwritten with RW_UNLOCKED further on. kern_malloc.c: - `size' is always initialized with the proper value before being used. kern_exit.c: - `error' is always caught and returned immediately. abort2() never returns a non-zero value. kern_exec.c: - `len' is always assigned inside the if-statement right below it. tty_info.c: - `td' is always overwritten by FOREACH_THREAD_IN_PROC(). Found by: LLVM's scan-build
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_exec.c3
-rw-r--r--sys/kern/kern_exit.c2
-rw-r--r--sys/kern/kern_malloc.c2
-rw-r--r--sys/kern/kern_rwlock.c1
-rw-r--r--sys/kern/kern_sig.c6
-rw-r--r--sys/kern/kern_synch.c1
-rw-r--r--sys/kern/kern_thr.c4
-rw-r--r--sys/kern/kern_time.c2
-rw-r--r--sys/kern/tty_info.c1
9 files changed, 2 insertions, 20 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index c89c9a6..36a9fc8 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -591,7 +591,6 @@ interpret:
len = min(ndp->ni_cnd.cn_namelen,MAXCOMLEN);
bcopy(ndp->ni_cnd.cn_nameptr, p->p_comm, len);
} else {
- len = MAXCOMLEN;
if (vn_commname(binvp, p->p_comm, MAXCOMLEN + 1) == 0)
len = MAXCOMLEN;
else {
@@ -1061,8 +1060,6 @@ exec_copyin_args(struct image_args *args, char *fname,
int error;
size_t length;
- error = 0;
-
bzero(args, sizeof(*args));
if (argv == NULL)
return (EFAULT);
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 4b4a417..4255734 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -585,8 +585,6 @@ abort2(struct thread *td, struct abort2_args *uap)
void *uargs[16];
int error, i, sig;
- error = 0; /* satisfy compiler */
-
/*
* Do it right now so we can log either proper call of abort2(), or
* note, that invalid argument was passed. 512 is big enough to
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 02a1e7e..8c627a1 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -435,8 +435,6 @@ free(void *addr, struct malloc_type *mtp)
addr = redzone_addr_ntor(addr);
#endif
- size = 0;
-
slab = vtoslab((vm_offset_t)addr & (~UMA_SLAB_MASK));
if (slab == NULL)
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c
index dca982b..531e145 100644
--- a/sys/kern/kern_rwlock.c
+++ b/sys/kern/kern_rwlock.c
@@ -732,7 +732,6 @@ _rw_wunlock_hard(struct rwlock *rw, uintptr_t tid, const char *file, int line)
CTR2(KTR_LOCK, "%s: %p unrecursing", __func__, rw);
return;
}
- v = rw->rw_lock;
KASSERT(rw->rw_lock & (RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS),
("%s: neither of the waiter flags are set", __func__));
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index f4cf8ad..7460c13 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -2585,7 +2585,6 @@ postsig(sig)
sig_t action;
ksiginfo_t ksi;
sigset_t returnmask;
- int code;
KASSERT(sig != 0, ("postsig"));
@@ -2653,10 +2652,7 @@ postsig(sig)
ps->ps_sigact[_SIG_IDX(sig)] = SIG_DFL;
}
td->td_ru.ru_nsignals++;
- if (p->p_sig != sig) {
- code = 0;
- } else {
- code = p->p_code;
+ if (p->p_sig == sig) {
p->p_code = 0;
p->p_sig = 0;
}
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index bc539af..b91c1a5 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -173,7 +173,6 @@ _sleep(void *ident, struct lock_object *lock, int priority,
}
catch = priority & PCATCH;
pri = priority & PRIMASK;
- rval = 0;
/*
* If we are already on a sleep queue, then remove us from that
diff --git a/sys/kern/kern_thr.c b/sys/kern/kern_thr.c
index 3802259..4059443 100644
--- a/sys/kern/kern_thr.c
+++ b/sys/kern/kern_thr.c
@@ -149,7 +149,6 @@ create_thread(struct thread *td, mcontext_t *ctx,
struct proc *p;
int error;
- error = 0;
p = td->td_proc;
/* Have race condition but it is cheap. */
@@ -253,7 +252,7 @@ create_thread(struct thread *td, mcontext_t *ctx,
sched_add(newtd, SRQ_BORING);
thread_unlock(newtd);
- return (error);
+ return (0);
}
int
@@ -403,7 +402,6 @@ thr_suspend(struct thread *td, struct thr_suspend_args *uap)
struct timespec ts, *tsp;
int error;
- error = 0;
tsp = NULL;
if (uap->timeout != NULL) {
error = copyin((const void *)uap->timeout, (void *)&ts,
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 7ccbb6a..a8ecace 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -1367,10 +1367,8 @@ realtimer_expire(void *arg)
struct timespec cts, ts;
struct timeval tv;
struct itimer *it;
- struct proc *p;
it = (struct itimer *)arg;
- p = it->it_proc;
realtimer_clocktime(it->it_clockid, &cts);
/* Only fire if time is reached. */
diff --git a/sys/kern/tty_info.c b/sys/kern/tty_info.c
index b9d9c1a..d5885b9 100644
--- a/sys/kern/tty_info.c
+++ b/sys/kern/tty_info.c
@@ -261,7 +261,6 @@ tty_info(struct tty *tp)
PROC_LOCK(pick);
picktd = NULL;
- td = FIRST_THREAD_IN_PROC(pick);
FOREACH_THREAD_IN_PROC(pick, td)
if (thread_compare(picktd, td))
picktd = td;
OpenPOWER on IntegriCloud