Article View: linux.kernel.netdev
Article #19095Re: [PATCH net-next v2 2/2] net: sgi: ioc3-eth: take the MAC address from a device property
From: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 10:22
Date: Thu, 19 Nov 2026 10:22
184 lines
14994 bytes
14994 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 (2) · Medium: 2 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The new fallback in ioc3eth_probe()
(drivers/net/ethernet/sgi/ioc3-eth.c:861-863) calls…
- [Medium] On a board that has a 1-wire MAC PROM and also gets the new
device property, which MAC address ioc3eth_probe() uses depends on…
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but
ioc3eth_probe() never calls platform_set_drvdata(pdev, dev), while…
- [High] This problem wasn't introduced by this patch, but
ioc3eth_probe() requests the IRQ with devm_request_irq(&pdev->dev,…
--
net: sgi: ioc3-eth: take the MAC address from a device property
This commit adds a device_get_mac_address() fallback to ioc3eth_probe().
It is used when the MAC address can't be read from the 1-wire PROM, so
that boards without a PROM no longer defer probing forever.
> diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c
> index 25139cf5ff62c..fa844267c325a 100644
> --- a/drivers/net/ethernet/sgi/ioc3-eth.c
> +++ b/drivers/net/ethernet/sgi/ioc3-eth.c
> @@ -857,8 +857,9 @@ static int ioc3eth_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "Invalid resource\n");
> return -EINVAL;
> }
> - /* get mac addr from one wire prom */
> - if (ioc3eth_get_mac_addr(regs, mac_addr))
> + /* get mac addr from one wire prom, or from a device property */
> + if (ioc3eth_get_mac_addr(regs, mac_addr) &&
> + device_get_mac_address(&pdev->dev, mac_addr))
[Severity: Medium]
Can device_get_mac_address() succeed for this device on any in-tree board?
Only ioc3_eth_setup() in drivers/mfd/ioc3.c creates the ioc3-eth platform
device, and it does so from this cell:
drivers/mfd/ioc3.c:
static struct mfd_cell ioc3_eth_cells[] = {
{
.name = "ioc3-eth",
.resources = ioc3_eth_resources,
.num_resources = ARRAY_SIZE(ioc3_eth_resources),
},
The cell sets neither .swnode nor .of_compatible, and IP27/IP30 have no
DT or ACPI. So mfd_add_device() never gives the child a fwnode.
dev_fwnode() returns NULL and fwnode_get_mac_address() fails.
The second step, nvmem_get_mac_address(), ends up in
nvmem_cell_get_from_lookup(), which is keyed by dev_name(). The child is
registered with PLATFORM_DEVID_AUTO ("ioc3-eth.N.auto"), so board code
can't target it reliably. Nothing in tree registers such a lookup either.
As far as I can tell, boards without a 1-wire MAC PROM still defer
forever, which is the problem the commit message says this fixes.
Which board is this meant for? Is there a companion change to
drivers/mfd/ioc3.c, for example a software node with "mac-address" or
"local-mac-address" attached to the ioc3-eth cell?
The previous commit in the series mentions "IP35 support will hand it
window addresses", so the user may be out of tree or not posted yet. Could
the commit message say so?
[Severity: Medium]
What happens on a board that has the 1-wire PROM and also gets the
property?
ioc3eth_get_mac_addr() passes the nvmem_device_find() error through
unchanged:
nvmem = nvmem_device_find(prefix, ioc3eth_nvmem_match);
if (IS_ERR(nvmem))
return PTR_ERR(nvmem);
nvmem_device_match() in drivers/nvmem/core.c returns
ERR_PTR(-EPROBE_DEFER) whenever the PROM's nvmem device isn't registered
yet. So "no PROM fitted" and "PROM not enumerated yet" give the same
error here.
The PROM's nvmem device only appears after the w1 master kthread
(w1_process()->w1_search_process()) finds the slave and the family driver
binds. Also, the "ioc3-eth" cell comes before "sgi_w1" in
ioc3_eth_cells[], so the first ioc3-eth probe can run before the 1-wire
master exists at all.
Before this patch, any PROM failure deferred the probe, so a board with a
PROM always ended up using the PROM address. Now the first failed lookup
falls back to the property and probe succeeds. eth_hw_addr_set() and
ioc3_init() then program that address into EMAR_H/EMAR_L for the rest of
the boot.
Could the MAC address then change from boot to boot, depending on w1
enumeration timing? The new comment suggests the PROM takes priority, but
that only holds if enumeration finishes first.
A PROM with a bad CRC (-EINVAL) also falls back to the property without
any message, and nothing logs which source supplied the address.
> return -EPROBE_DEFER; /* not available yet */
>
> dev = alloc_etherdev(sizeof(struct ioc3_private));
[Severity: High]
This isn't a bug introduced by this patch, but ioc3eth_probe() never calls
platform_set_drvdata(pdev, dev), while ioc3eth_remove() relies on it:
drivers/net/ethernet/sgi/ioc3-eth.c:ioc3eth_remove() {
struct net_device *dev = platform_get_drvdata(pdev);
struct ioc3_private *ip = netdev_priv(dev);
unregister_netdev(dev);
timer_delete_sync(&ip->ioc3_timer);
...
}
After a successful probe, won't platform_get_drvdata() return NULL here?
If so, unregister_netdev(NULL) oopses. The timer_delete_sync() and
dma_free_coherent() calls would then work on a bogus ip pointer, and the
netdev, DMA rings and timer never get torn down.
This path is reachable through /sys/bus/platform/drivers/ioc3-eth/unbind
(suppress_bind_attrs isn't set), or by removing the parent IOC3 MFD
device.
Because this patch lets probe succeed on more boards, more systems can
reach this remove path.
[Severity: High]
This is also a pre-existing issue, but ioc3eth_probe() requests a shared
IRQ with devm and passes the net_device, which isn't devm-managed, as
dev_id:
if (devm_request_irq(&pdev->dev, dev->irq, ioc3_interrupt,
IRQF_SHARED, "ioc3-eth", dev)) {
Every error path after that ends here: rx/tx ring allocation failure, the
"Didn't find a PHY" case, and register_netdev() failure.
out_free:
free_netdev(dev);
return err;
The netdev was never registered, so free_netdev() frees it right away.
The IRQ stays installed until devres_release_all() runs after probe
returns. ioc3eth_remove() has the same ordering: it calls free_netdev(dev)
before devres frees the IRQ.
Can ioc3_interrupt() run on the freed net_device in that window?
static irqreturn_t ioc3_interrupt(int irq, void *dev_id)
{
struct ioc3_private *ip = netdev_priv(dev_id);
struct ioc3_ethregs *regs = ip->regs;
u32 eisr;
eisr = readl(®s->eisr);
writel(eisr, ®s->eisr);
...
An interrupt from another device on the shared line can trigger this.
With CONFIG_DEBUG_SHIRQ it always happens, because __free_irq() calls the
handler one extra time for IRQF_SHARED actions.
Either a plain request_irq()/free_irq() pair, with free_irq() called
before free_netdev(), or devm_alloc_etherdev() would avoid this.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116102115.27574-1-kaloz%40kernel.org
Technical Details
Message-ID:
<179508377126.3136.8138823841306639675@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366939-linux-kernel-netdev=dewy.ruReferences:
<20261116102115.27574-3-kaloz@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366939-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 2/2] net: sgi: ioc3-eth: take the MAC address from a device property Date: Thu, 19 Nov 2026 10:22:51 +0000 Organization: Usenet Network Message-ID: <179508377126.3136.8138823841306639675@kernel.org> References: <20261116102115.27574-3-kaloz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2847370"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:eZE0wfoTKDw+8lhrik83S6q0UuI= sha256:TecuPbTXi68fFHQK27dpK68PS6Jwvoz3+I5iaaaeWA8= sha1:naLsLrwzROxKI7fWEDH4CHWMC8E= sha256:CrkrKIbVEUIIJrYZ/r+pD2xCSIw/ksafizNfgUd2Hg4= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 71F571155BC; Thu, 19 Nov 2026 13:23:15 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.5 X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W4NX6uxgfLCQ; Thu, 19 Nov 2026 13:23:11 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-366939-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 394811155B4; Thu, 19 Nov 2026 13:23:01 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id B2AF5640E39; Thu, 19 Nov 2026 10:23:00 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795083773; b=4n7zhB36PQVH/mO6m0Q6S/9Gp9hzdNg2fhFEpoJzPcv85RhH5/uYm53CZnDJl25KeaGN VEtB2SvvPttfwT0clfHGGeQZe/D8wxlTVUntjadC0RhCJju8gs9tb1/27kMiRvHPi+vrK 2qqRbF8xtCEH19EpQpKGwWlyL7iXDU6eCzySYjimIdMQNuoeQ5+UsPNm5+uwz3tsEpShk dtXgdGsZFh+8oceBmarVPURoTEun6CTQJt2zPOlMygeStbV/H6yliCf/nNaclTarCA6nP 7/N3i06XNUjbGR9JmCyraqzjMuhEZ5y8DuvADL9PQytrXg0cL5+yv1xsdNhwSdsAjqA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795083773; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=wPVIvL96HjIC/G5XUmS2oSnBr5CQE3262Q+aEFqOucA=; b=vC0iwbRvmWdmDUH91YJHMcpYNcS/Se8KWy5KX7R9NrbTEIJZsY+pCMNoAg6uSSq/BuD/ 6nyEdO8gFNwfwMlZwObFWcMF4SZRik3tGdht5k5Qyzwd3MA9ktdKyzZaKEqPYpHqFaIoP vqfu+vj6rZAknrePUM8sPn5TNKBrugYrS07yrLP21OYSCX0XP94BG3BrmnuSwnAI2H7gz JJTyhc5UbES18yfiSOKNcMi+aH+cprWiHkdzoDSaeZ0xynkHfQYhbI1d+Oswq9C7VPz/Y VTDLE0Z1MyRxdaF2rm5KXDjP6Nj1jRxI0zrGmMgePP7WvJObMzJ6lYpFUhACXJ9ODsw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oBviKqwO; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4CCC960A2601; Thu, 19 Nov 2026 10:22:53 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oBviKqwO X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795083772; b=OZSoe+kLjf0Zzc/CMQZDWBckasK0rFE3DvG+39s3PORjutFWkX1bGYSWKu2vqKZWSfpP FQtVZJehhLfjfnPkYdhVXKD+ND5YveZjzCXs0A3H736wTuKyk7O0pZRwp5/QV+kp3jdS7 6EzFDC3U+xg5qzAscIDO4Nela98vHM9sJ7GLHblm2ycCwtp1glGFxHg1sms6pNHAb+aDr PaTDJmiYusm7t4ceAAkS2g6waD6zmnRXUg5IxTy4T0L6ITCL+unerz3PhmyDgeMZEnz8m az+nIhRJQ/Dg5qPfLpDERDwnPljpBpCRb02UMt5ClHiPP+GWgWg0f+MDCSJ7mqS4+4A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795083772; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=wPVIvL96HjIC/G5XUmS2oSnBr5CQE3262Q+aEFqOucA=; b=xMINKDJ3cJQFfn0AKEY6jS8zynu59FIrcHGPMVtqMg+0WfoqL7/iw4mvX7snNYJGYtME klzCBJAyhq6bzLemEAfCdKFi2yBISTivRx5Kjio3akY395lTjISJ5BD5A7APTKtjimoJw ZcRa68M9eAY2fOFrZV18vZlX7jhHQz1xoKE6oDoHMAmzXyIOjLyt0LxrBZuUaImlzZS0O YZ5XsEji7sAAuq1LKvlYIZ6hh317uWRVM/lZ95bH4OW8hVd3rRYYUwehPzUV0NltryssG Uv92N94dd5Jrvu4nis1495RvkDZrcIrU4wfRoLb9D4ZgyzWZxP75IjweyV9NhtKE/pQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=oBviKqwO; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C300606A334; Thu, 19 Nov 2026 10:22:52 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B386C1F000C5; Thu, 19 Nov 2026 10:22:51 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795083772; bh=wPVIvL96HjIC/G5XUmS2oSnBr5CQE3262Q+aEFqOucA=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=oBviKqwO4UPllqvcmE/GMQO2l40xuUnH+AscQfq5vQDk7NFfLuII67SLofbeC8Y1k EqVJNnHebWlJKuNgYusA1LDqrmcIiNrJHlXWdx+gwvTNCcJ5nksDIwAx1W3xWIygqk MVTddbm9zT4rOkJbNA6bIN7VU3f0EKj/bWrnrM1XQmygHMaS96KudiYiE5T7cB+Lfv UPzStIIWJ2Hy4JFvCSuFE5ZJ4botZJ4mWHepAeArIZx4zgyz3C77BFweB2U1eaQ1gK qno2EL5d69vgzP/FGGzeHnFKCpJzEFTzEZhPHXm759JLqh8QzPiX2xQkNSaKDQTqqx uIHrvWVqFzDWw== X-Cc: tsbogend@alpha.franken.de, netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261116102115.27574-3-kaloz@kernel.org> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list