Kernel: resolve Coverity warnings

This commit is contained in:
David van Moolenbroek 2012-08-15 11:12:11 +00:00
parent 0b5c2a058c
commit 8e116b71a1
5 changed files with 7 additions and 13 deletions

View file

@ -594,6 +594,7 @@ static u32_t lapic_errstatus(void)
return lapic_read(LAPIC_ESR); return lapic_read(LAPIC_ESR);
} }
#ifdef CONFIG_SMP
static int lapic_disable_in_msr(void) static int lapic_disable_in_msr(void)
{ {
u32_t msr_hi, msr_lo; u32_t msr_hi, msr_lo;
@ -605,6 +606,7 @@ static int lapic_disable_in_msr(void)
return 1; return 1;
} }
#endif /* CONFIG_SMP */
void lapic_disable(void) void lapic_disable(void)
{ {
@ -626,6 +628,7 @@ void lapic_disable(void)
return; return;
} }
#ifdef CONFIG_SMP
val = lapic_read(LAPIC_LINT0) & 0xFFFE58FF; val = lapic_read(LAPIC_LINT0) & 0xFFFE58FF;
val |= APIC_ICR_INT_MASK; val |= APIC_ICR_INT_MASK;
lapic_write (LAPIC_LINT0, val); lapic_write (LAPIC_LINT0, val);
@ -639,6 +642,7 @@ void lapic_disable(void)
lapic_write(LAPIC_SIVR, val); lapic_write(LAPIC_SIVR, val);
lapic_disable_in_msr(); lapic_disable_in_msr();
#endif /* CONFIG_SMP */
} }
static int lapic_enable_in_msr(void) static int lapic_enable_in_msr(void)

View file

@ -213,7 +213,7 @@ static int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
static u32_t phys_get32(phys_bytes addr) static u32_t phys_get32(phys_bytes addr)
{ {
const u32_t v; u32_t v;
int r; int r;
if((r=lin_lin_copy(NULL, addr, if((r=lin_lin_copy(NULL, addr,

View file

@ -90,7 +90,6 @@ int runqueues_ok_cpu(unsigned cpu)
} }
} }
l = 0;
for (xp = BEG_PROC_ADDR; xp < END_PROC_ADDR; ++xp) { for (xp = BEG_PROC_ADDR; xp < END_PROC_ADDR; ++xp) {
if(!proc_ptr_ok(xp)) { if(!proc_ptr_ok(xp)) {
printf("xp bogus pointer in proc table\n"); printf("xp bogus pointer in proc table\n");
@ -101,10 +100,6 @@ int runqueues_ok_cpu(unsigned cpu)
if(proc_is_runnable(xp) && !xp->p_found) { if(proc_is_runnable(xp) && !xp->p_found) {
printf("sched error: ready proc %d not on queue\n", xp->p_nr); printf("sched error: ready proc %d not on queue\n", xp->p_nr);
return 0; return 0;
if (l++ > MAX_LOOP) {
printf("loop in debug.c?\n");
return 0;
}
} }
} }
@ -145,7 +140,7 @@ rtsflagstr(const u32_t flags)
static char str[100]; static char str[100];
str[0] = '\0'; str[0] = '\0';
#define FLAG(n) if(flags & n) { strcat(str, #n " "); } #define FLAG(n) if(flags & n) { strlcat(str, #n " ", sizeof(str)); }
FLAG(RTS_SLOT_FREE); FLAG(RTS_SLOT_FREE);
FLAG(RTS_PROC_STOP); FLAG(RTS_PROC_STOP);

View file

@ -932,6 +932,7 @@ static int mini_receive(struct proc * caller_ptr,
printf("mini_receive: sending notify from NONE\n"); printf("mini_receive: sending notify from NONE\n");
} }
#endif #endif
assert(src_proc_nr != NONE);
unset_notify_pending(caller_ptr, src_id); /* no longer pending */ unset_notify_pending(caller_ptr, src_id); /* no longer pending */
/* Found a suitable source, deliver the notification message. */ /* Found a suitable source, deliver the notification message. */
@ -1250,8 +1251,6 @@ asyn_error:
} }
return(OK); return(OK);
return r;
} }
/*===========================================================================* /*===========================================================================*

View file

@ -46,9 +46,5 @@ int do_sysctl(struct proc * caller, message * m_ptr)
printf("do_sysctl: invalid request %d\n", m_ptr->SYSCTL_CODE); printf("do_sysctl: invalid request %d\n", m_ptr->SYSCTL_CODE);
return(EINVAL); return(EINVAL);
} }
panic("do_sysctl: can't happen");
return(OK);
} }