mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zachary Aflalo <zac@belligerently.dev>
To: "parthiban.veerasooran@microchip.com"
	<parthiban.veerasooran@microchip.com>,
	"christian.gromm@microchip.com" <christian.gromm@microchip.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Zachary Aflalo <zachary@aflalo.com>
Subject: [PATCH] staging: most: net: Preserve network device registration errors
Date: Wed, 11 Nov 2026 02:42:07 +0000	[thread overview]
Message-ID: <YT3PR01MB910878CBF3D8FF5F25367214AF712@YT3PR01MB9108.CANPRD01.PROD.OUTLOOK.COM> (raw)

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

             reply	other threads:[~2026-11-11  2:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  2:42 Zachary Aflalo [this message]
2026-11-20  7:16 ` gregkh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YT3PR01MB910878CBF3D8FF5F25367214AF712@YT3PR01MB9108.CANPRD01.PROD.OUTLOOK.COM \
    --to=zac@belligerently.dev \
    --cc=christian.gromm@microchip.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=parthiban.veerasooran@microchip.com \
    --cc=zachary@aflalo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®