Linux kernel staging patches
 help / color / mirror / Atom feed
* [PATCH] staging: most: net: Preserve network device registration errors
@ 2026-11-11  2:42 Zachary Aflalo
  2026-11-20  7:16 ` gregkh
  0 siblings, 1 reply; 2+ messages in thread
From: Zachary Aflalo @ 2026-11-11  2:42 UTC (permalink / raw)
  To: parthiban.veerasooran@microchip.com,
	christian.gromm@microchip.com
  Cc: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org, Zachary Aflalo

From: Zachary Aflalo <zachary@aflalo.com>

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@aflalo.com>
---
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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-20  7:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-11  2:42 [PATCH] staging: most: net: Preserve network device registration errors Zachary Aflalo
2026-11-20  7:16 ` gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox