Skip to content

Commit

Permalink
kern: Fix many V warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsuki committed Mar 2, 2025
1 parent 62dbfb9 commit 2ab8b7a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion kernel/modules/acpi/madt.v
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ __global (
)

fn madt_init() {
madt := unsafe { &MADT(find_sdt('APIC', 0) or { panic('System does not have a MADT') }) }
madt = unsafe { &MADT(find_sdt('APIC', 0) or { panic('System does not have a MADT') }) }

mut current := u64(0)

Expand Down
2 changes: 1 addition & 1 deletion kernel/modules/fs/vfs.v
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ fn path2node(parent &VFSNode, path string) (&VFSNode, &VFSNode, string) {
return 0, 0, ''
}

new_node := reduce_node(unsafe { current_node.children[elem_str] }, false)
mut new_node := reduce_node(unsafe { current_node.children[elem_str] }, false)

if last == true {
return current_node, new_node, elem_str
Expand Down
24 changes: 12 additions & 12 deletions kernel/modules/socket/socket.v
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ pub fn syscall_accept(_ voidptr, fdnum int) (u64, u64) {
fd.unref()
}

res := fd.handle.resource
mut res := fd.handle.resource

mut sock := &sock_pub.Socket(unsafe { nil })

if res is sock_unix.UnixSocket {
if mut res is sock_unix.UnixSocket {
sock = res
} else {
return errno.err, errno.einval
Expand Down Expand Up @@ -149,11 +149,11 @@ pub fn syscall_bind(_ voidptr, fdnum int, _addr voidptr, addrlen u32) (u64, u64)
fd.unref()
}

res := fd.handle.resource
mut res := fd.handle.resource

mut sock := &sock_pub.Socket(unsafe { nil })

if res is sock_unix.UnixSocket {
if mut res is sock_unix.UnixSocket {
sock = res
} else {
return errno.err, errno.einval
Expand All @@ -178,11 +178,11 @@ pub fn syscall_listen(_ voidptr, fdnum int, backlog int) (u64, u64) {
fd.unref()
}

res := fd.handle.resource
mut res := fd.handle.resource

mut sock := &sock_pub.Socket(unsafe { nil })

if res is sock_unix.UnixSocket {
if mut res is sock_unix.UnixSocket {
sock = res
} else {
return errno.err, errno.einval
Expand All @@ -208,11 +208,11 @@ pub fn syscall_recvmsg(_ voidptr, fdnum int, msg &sock_pub.MsgHdr, flags int) (u
fd.unref()
}

res := fd.handle.resource
mut res := fd.handle.resource

mut sock := &sock_pub.Socket(unsafe { nil })

if res is sock_unix.UnixSocket {
if mut res is sock_unix.UnixSocket {
sock = res
} else {
return errno.err, errno.einval
Expand All @@ -238,11 +238,11 @@ pub fn syscall_connect(_ voidptr, fdnum int, _addr voidptr, addrlen u32) (u64, u
fd.unref()
}

res := fd.handle.resource
mut res := fd.handle.resource

mut sock := &sock_pub.Socket(unsafe { nil })

if res is sock_unix.UnixSocket {
if mut res is sock_unix.UnixSocket {
sock = res
} else {
return errno.err, errno.einval
Expand All @@ -268,11 +268,11 @@ pub fn syscall_getpeername(_ voidptr, fdnum int, _addr voidptr, addrlen &u32) (u
fd.unref()
}

res := fd.handle.resource
mut res := fd.handle.resource

mut sock := &sock_pub.Socket(unsafe { nil })

if res is sock_unix.UnixSocket {
if mut res is sock_unix.UnixSocket {
sock = res
} else {
return errno.err, errno.einval
Expand Down
4 changes: 2 additions & 2 deletions kernel/modules/socket/unix/unix.v
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,11 @@ fn (mut this UnixSocket) connect(handle voidptr, _addr voidptr, addrlen u32) ? {

mut target := fs.get_node(t.process.current_directory, path, true) or { return none }

target_res := target.resource
mut target_res := target.resource

mut socket := &UnixSocket(unsafe { nil })

if target_res is UnixSocket {
if mut target_res is UnixSocket {
socket = target_res
} else {
errno.set(errno.einval)
Expand Down

0 comments on commit 2ab8b7a

Please sign in to comment.