Age | Commit message (Collapse) | Author |
|
The pattern is !x&y. An expression of this form is almost always
meaningless, because it combines a boolean operator with a bit
operator. In particular, if the rightmost bit of y is 0, the result
will always be 0.
Fixed using coccinelle.
// !x&y combines boolean negation with bitwise and
//
// Confidence: High
// Copyright: (C) Gilles Muller, Julia Lawall, EMN, DIKU. GPLv2.
// URL: http://www.emn.fr/x-info/coccinelle/rules/notand.html
// Options:
@@ expression E; constant C; @@
(
!E & !C
|
- !E & C
+ !(E & C)
)
* linux/src/drivers/net/tlan.c: Fix bit tests.
* linux/src/drivers/scsi/AM53C974.c: Likewise.
* linux/src/drivers/scsi/FlashPoint.c: Likewise.
* linux/src/drivers/scsi/NCR5380.c: Likewise.
* linux/src/drivers/scsi/t128.c: Likewise.
|
|
Previously, the size of struct kmem_cache was 136 bytes, just eight
bytes larger than 128 bytes, which is typically two cache lines on
today's CPUs.
By reducing the size of the name field which holds a human-readable
description by eight bytes to 24 bytes, the struct kmem_cache can be
made fit into two cache lines. This change should not affect the
usefulness of this field. For reference, the length of the largest
hard-coded name is 17.
* kern/slab.h (KMEM_CACHE_NAME_SIZE): Define to 24.
|
|
* kern/task.h (struct task): Reduce the size of struct task by
2 * sizeof boolean_t by using a bit field for the boolean flags.
|
|
Previously, the bit field left 31 bits unused. By reducing the size
of wire_count by one bit, the size of the whole struct is reduced by
four bytes.
* vm/vm_page.h (struct vm_page): Reduce the size of wire_count to 15
bits.
|
|
* vm/vm_page.h (struct vm_page): Merge the two bit fields.
|
|
Apparently, the NS32000 was a 32-bit CPU from the 1990ies. The string
"ns32000" appears nowhere else in the source.
* vm/vm_page.h (struct vm_page): Remove NS32000-specific padding.
|
|
* i386/i386at/kd.c (kd_xga_init): Add start, stop variables, read them
from CRT registers, make sure the cursor is enabled and is not reduced
to 0, and write them back to CRT registers.
* i386/i386at/kd.h (C_START, C_STOP): New macros.
|
|
* i386/include/mach/i386/mach_i386_types.h (MACH_KERNEL): Add comments after else and endif.
|
|
* i386/i386/io_perm.h (_I386_IO_PERM_H_): Add comment after endif.
|
|
|
|
|
|
* kern/strings.c (strlen): Mark with attribute pure.
|
|
* ddb/db_watch.c (db_watchpoint_cmd) (db_option): Remove forward declaration.
|
|
Declare void argument lists that were not declared in the first
part of this patch and
* kern/sched_prim.h (recompute_priorities): Fix prototype.
* kern/startup.c (setup_main) (recompute_priorities): Fix call.
|
|
* i386/i386at/kd_event.h: Add missing includes.
|
|
* kern/eventcount.c (simpler_thread_setrun) (enqueue_head) (th): Avoid the cast.
* kern/thread.c (thread_halt_self) (enqueue_tail) (thread): Likewise.
* kern/thread_swap.c (thread_swapin) (enqueue_tail) (thread): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* device/ds_routines.c (device_write_trap) (copyin) (data): Cast to (void *). Argument is an address.
(device_write_trap) (copyin) (io_data): Don't cast.
(device_writev_trap) (copyin) (iovec, stack_iovec): Likewise.
(device_writev_trap) (copyin) (data, p): Cast to (void *). Arguments are addresses.
* kern/bootstrap.c (build_args_and_stack) (copyout) (arg_count, string_pos, zero): Don't cast.
* kern/ipc_mig.c (syscall_vm_map) (copyin, copyout) (addr, address): Likewise.
(syscall_vm_allocate) (copyin, copyout) (addr, address): Likewise.
(syscall_task_create) (copyout) (name, child_task): Likewise.
(syscall_mach_port_allocate) (copyout) (name, namep): Likewise.
* kern/time_stamp.c (copyout) (temp, tsp): Likewise.
|
|
Attribute noreturn is used irrespective of __GNUC__. Remove
unnecessary #ifdef.
* kern/sched_prim.h [__GNUC__]: Remove #ifdef.
|
|
* xen/console.h: Add missing includes.
|
|
* kern/lock.h (simple_lock_data_empty): Define.
(decl_simple_lock_data, simple_unlock): Likewise.
* kern/sched_prim.c (lock): Declare.
[MACH_SLOCKS]: Remove #ifs.
* kern/task.c (task_lock, task_unlock): Remove address operator.
|
|
* ddb/db_command.h (db_error): Mark with attribute noreturn.
* i386/i386/setjmp.h (_longjmp): Likewise.
|
|
* i386/i386/db_trace.c (db_lookup_i386_kreg) (kregp): Use (long *) instead of an (int *).
|
|
to unsigned
* device/dev_pager.c (device_pager_data_request_done) (memset) (io_residual): Cast to size_t instead to unsigned.
|
|
Variable pager is already of ipc_port_t type.
* device/dev_pager.c: Remove unnecessary casts.
|
|
Avoid the casts by passing the address of the links thread
structure member to enqueue_tail().
* kern/sched_prim.c: Avoid casts.
|
|
|
|
Thanks Marin Ramesa and Richard Braun for investigating.
* i386/i386at/kd.c (kdintr): Make `char_idx' and `max' unsigned.
(kdstate2idx): Make function take and return unsigned ints for the state.
* i386/i386at/kd.h (kdstate2idx): Likewise.
|
|
* i386/i386/ast_check.c (init_ast_check, cause_ast_check): Define return type.
* i386/i386/pic.c (intnull, prtnull): Define argument types.
* i386/i386at/com.c (compr_addr): Likewise.
(compr): Likewise.
(compr_addr): Fix printf format.
* i386/i386at/kd.c (kd_cmdreg_write, kd_kbd_magic): Define argument types.
* i386/i386at/kd_mouse.c (init_mouse_hw): Likewise.
* ipc/mach_port.c (sact_count): Define return type.
* ipc/mach_rpc.c (mach_port_rpc_sig): Define argument types.
* kern/act.c (dump_act): Define return type.
* kern/lock_mon.c (simple_lock, simple_lock_try, simple_unlock, lip, lock_info_sort, lock_info_clear, print_lock_info): Define return type.
(time_lock): Define return type and argument type.
* kern/timer.c (time_trap_uexit): Define argument type.
|
|
Initialize lhs to zero to avoid uninitialized usage in db_unary().
* ddb/db_expr.c (db_mult_expr) (lhs): Initialize to zero.
|
|
Now that we have returns there are no more warnings from GCC about
uninitialized variable. Remove unnecessary initialization of variable
bkpt.
* ddb/db_break.c (db_delete_cmd) (bkpt): Remove unnecessary initialization.
|
|
Variable addr and member address are already of db_addr_t type which
is type defined as vm_offset_t.
* ddb/db_break.c (db_find_breakpoint_here) (DB_PHYS_EQ) (addr, address): Remove unecessary casts.
|
|
Members offset and phys_addr are of vm_offset_t types.
* vm/vm_resident.c (vm_page_print) (offset, phys_addr): Remove unnecessary casts.
|
|
The return value from vm_map_min() is already of vm_offset_t type.
* vm/vm_kern.c (kmem_submap) (addr): Remove unnecessary cast.
|
|
* i386/i386/ldt.c (syscall): Remove forward declaration.
Include locore.h.
* i386/i386/locore.h (syscall): Add prototype.
|
|
This is mach_clock.c, not clock_prim.c.
* kern/mach_clock.c: Update comment.
|
|
|
|
* i386/i386at/kd_mouse.c (kd_mouse_open) (kdintr): Remove forward declaration.
|
|
* i386/i386at/kd.c (kdinit) (kd_xga_init): Remove forward declaration.
* i386/i386at/kd.h (kd_xga_init): Add prototype.
|
|
Variable off is already an unsigned int.
* i386/i386at/kd.c (kdmmap) (off): Remove unnecessary cast.
|
|
* i386/i386at/kd.c (kd_getdata, state2leds, kdstart, kdstop): Remove forward declarations.
* i386/i386at/kd.h (kd_getdata, state2leds, kdstart, kdstop): Add prototypes.
Include device/tty.h.
|
|
Argument to INKERNEL() is already cast to vm_offset_t in the macro itself.
* i386/i386/db_trace.c (db_i386_stack_trace) (INKERNEL) (callpc): Don't cast to unsigned long.
(db_i386_stack_trace) (INKERNEL) (frame): Likewise.
|
|
* i386/Makefrag.am: List i386/i386/db_trace.h.
* i386/i386/db_trace.c: Include machine/db_trace.h.
(db_i386_stack_trace): Remove forward declaration.
* i386/i386/db_trace.h: New file.
Add copyright.
[_I386_DB_TRACE_H_]: Add ifndef.
(i386_frame): Declare forward.
(db_i386_stack_trace): Add prototype.
|
|
Member ip_kobject is of type vm_offset_t.
* ipc/mach_debug.c (mach_port_kernel_object) (ip_kobject): Remove unnecessary cast.
|