diff options
author | Ed Schouten <ed@FreeBSD.org> | 2009-02-26 15:51:54 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2009-02-26 15:51:54 +0000 |
commit | c90c9021e94dd95b34bb48c3f8bb29761379a8d8 (patch) | |
tree | d89376ead0217f0b0f64e8d12308efc93860e35a | |
parent | 34a839f1085b64b2c508f0ecba1749b930624796 (diff) | |
download | src-c90c9021e94dd95b34bb48c3f8bb29761379a8d8.tar.gz src-c90c9021e94dd95b34bb48c3f8bb29761379a8d8.zip |
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
Notes
Notes:
svn path=/head/; revision=189074
-rw-r--r-- | sys/kern/kern_exec.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_exit.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_malloc.c | 2 | ||||
-rw-r--r-- | sys/kern/kern_rwlock.c | 1 | ||||
-rw-r--r-- | sys/kern/kern_sig.c | 6 | ||||
-rw-r--r-- | sys/kern/kern_synch.c | 1 | ||||
-rw-r--r-- | sys/kern/kern_thr.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_time.c | 2 | ||||
-rw-r--r-- | sys/kern/tty_info.c | 1 |
9 files changed, 2 insertions, 20 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index c89c9a66a6eb..36a9fc87b670 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 4b4a417262ed..425573474b9b 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 02a1e7ece6a9..8c627a1639b7 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 dca982ba14aa..531e145ed548 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 f4cf8ad05a59..7460c13caac9 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 bc539afe1cc5..b91c1a50bc27 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 3802259c047f..4059443194be 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 7ccbb6a0b40e..a8ecace9a868 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 b9d9c1a79785..d5885b926576 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; |