[PATCH] staging: most: net: Preserve network device registration errors
From: Zachary Aflalo
Date: Tue Nov 10 2026 - 21:42:56 EST
From: Zachary Aflalo <zachary@xxxxxxxxxx>
comp_probe_channel() replaces every register_netdev() failure with
-EINVAL. This hides errors such as -ENOMEM and -EINTR from the MOST core
and the configfs create_link interface.
Save the registration error and return it through the existing unlock
path. Keep mapping -ENODEV to -EINVAL because configfs uses -ENODEV to
accept a deferred link when the device or component is missing. Returning
that error for a failed registration would incorrectly acknowledge the
link request as deferred configuration.
Codex assisted the source review, implementation, and commit message.
Fixes: d4a8ce7f57fc ("Staging: most: add MOST driver's aim-network module")
Signed-off-by: Zachary Aflalo <zachary@xxxxxxxxxx>
---
Validation:
Built the original and final driver objects on Debian ARM64 with
GCC 14.2.0, W=1 and C=2, using upstream sparse at
84ec0658c81db4ccc4aabc420d3dc118c2c6a310. No driver diagnostics or new
warnings. Both versions produce the same unrelated sparse warning in
arch/arm64/kernel/vdso/vgetrandom.c for __kernel_getrandom.
Extracted-function tests with mocked dependencies cover both channel
directions, registration failures (including -ENODEV), successful
registration, duplicate-link rejection, lock balance, and the actual
configfs create_link store function. These are native userspace tests,
not kernel runtime or hardware tests. No physical MOST hardware tested.
AI assistance:
Codex inspected staging error paths, proposed this focused correction,
checked caller behavior, wrote the change and mocked tests, and drafted
this message. The prompts requested a small meaningful staging fix,
preservation of existing behavior, and validation before submission.
drivers/staging/most/net/net.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
index e6e4498d3..5dc867d0c 100644
--- a/drivers/staging/most/net/net.c
+++ b/drivers/staging/most/net/net.c
@@ -334,9 +334,12 @@ static int comp_probe_channel(struct most_interface *iface, int channel_idx,
goto unlock;
}
- if (register_netdev(nd->dev)) {
+ ret = register_netdev(nd->dev);
+ if (ret) {
netdev_err(nd->dev, "register_netdev() failed\n");
- ret = -EINVAL;
+ /* Configfs treats -ENODEV as a deferred link. */
+ if (ret == -ENODEV)
+ ret = -EINVAL;
goto unlock;
}
}
base-commit: 067c5c24cef23d913b67eaaf71ae67e7169a6620