mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-21 15:45:02 +00:00
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
This commit is contained in:
parent
34a839f108
commit
c90c9021e9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=189074
@ -591,7 +591,6 @@ do_execve(td, args, mac_p)
|
||||
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);
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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__));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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. */
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user