diff options
author | Himbeer <himbeer@disroot.org> | 2024-07-30 12:55:51 +0200 |
---|---|---|
committer | Himbeer <himbeer@disroot.org> | 2024-07-30 12:55:51 +0200 |
commit | 7d3505c96c4e914813871115aa8286bcf08b3b84 (patch) | |
tree | 884ffa5c6f672b1e8546bc168ebb85ffe4ba8daa | |
parent | f8db981dfc4aa0ed90c81979a2487934ea3edbe2 (diff) |
hwinfo: Fix ByKind.next() error handling / returning
-rw-r--r-- | src/lib/hwinfo.zig | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/hwinfo.zig b/src/lib/hwinfo.zig index fb4a087..62eacf2 100644 --- a/src/lib/hwinfo.zig +++ b/src/lib/hwinfo.zig @@ -20,6 +20,7 @@ pub const DevKind = enum(u32) { plic, pcie, pci, + _, pub fn parse(buf: []const u8) !DevKind { if (std.mem.eql(u8, buf, "cpus")) { @@ -85,10 +86,8 @@ pub const ByKind = struct { const reader = it.stream.reader(); while (reader.readStructEndian(Dev, endian)) |device| { - if (device.kind == it.kind) { - return device; - } - } else |_| {} + if (device.kind == it.kind) return device; + } else |err| return err; return null; } |