From 2d1719da73d9c97eb186949ad7a465ac2cb38617 Mon Sep 17 00:00:00 2001 From: Liav A Date: Sat, 4 Feb 2023 14:15:37 +0200 Subject: Kernel/Net: Propagate proper errno codes from determine_network_device Returning literal strings is not the proper action here, because we should always assume that error could be propagated back to userland, so we need to keep a valid errno when returning an Error. --- Kernel/Net/NetworkingManagement.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Kernel/Net/NetworkingManagement.cpp') diff --git a/Kernel/Net/NetworkingManagement.cpp b/Kernel/Net/NetworkingManagement.cpp index c8b1ae7bb0..d0d95a123e 100644 --- a/Kernel/Net/NetworkingManagement.cpp +++ b/Kernel/Net/NetworkingManagement.cpp @@ -117,7 +117,8 @@ UNMAP_AFTER_INIT ErrorOr> NetworkingManagement return adapter; } } - return Error::from_string_literal("Unsupported network adapter"); + dmesgln("Networking: Failed to initialize device {}, unsupported network adapter", device_identifier.address()); + return Error::from_errno(ENODEV); } bool NetworkingManagement::initialize() -- cgit v1.2.3