Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796093196; b=Q1pSN+FXAOSHOD0kKrViBTirrIhlVRpSE58Us/kyb6Dj/qQATLosecEXK/KmYT4jJm2v KLeLngi0wEvgsOb7vl97SuMv/VzjJcEHVEawrQQEaCJdC2CR9+qJ0EteQoDXfBvJcC5H6 +NvAfxJPs3gWwHtBjdxpFX5x96bamgjYZcKP0r2ijYvfwtFB1hTtBFn0bPwKeDQBVeLGR LDKLTPV4PKOju0JstWZusL+Y/OytlijArPkpAa0JohVNAorpURXvzSKQ/y0aCQ4JeZMTU 0NqIhenDzo2p1dCTgPL0CS2sQOHpustsOBH17yZdKjdsQ84gzJ+N0odupXjYXn4krPA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796093196; 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=bJ5xhCwbVp5+5IOFkSNp4yrhLMuu2cmCPnbpOq05+I0=; b=PxOzlLcmzQMgPlSK5yIKccvHunb5FFMTeUOo3IKmpJaiMfC/uERQAdvwO5g4yZthUdj2 kpB2xP3ZemzfAVwxGnqy+0R4B1cRlL76TajFe7crsmboYVm1o4FBT/WnhJHRm12OTtKOE yKYMxOCIqX2li4JESfCOiXPBpYc47wZRKqq2FikLysibwJD0vrprjiVv9srWIcCvjHxYG 26JJOMpVOv+seldj5tw1Efp05RpcgLcGlZNpLI6NbASvUFvZ912R976JAmo/h1fkGZdZm TKUZ6l/UftS1Xhhs8zWVFH8VajROaqe4caIxI1YJmTwOsB/Nr/plWkpnReFnu7Rdvbw== 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=C3ht4Eyg; arc=none smtp.remote-ip=100.103.45.18 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 F3BAD606A32E for ; Tue, 1 Dec 2026 02:46:35 +0000 (UTC) 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=C3ht4Eyg Received: by smtp.kernel.org (Postfix) with ESMTPSA id 093FC1F00899; Tue, 1 Dec 2026 02:46:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796093195; bh=bJ5xhCwbVp5+5IOFkSNp4yrhLMuu2cmCPnbpOq05+I0=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=C3ht4EygoJKIiQ7g5AZCEmTbJtXiXKdvNnYrJrjL39jlIgdQntwKhT39H7HhTbRP3 FcSYbXfJeOisCd2/WCiR0G3tqHv7MBruJc/0a+Lgh/C1UoRbT26fA04WyB4woIdm7p 9S65xQpBQKQWjPxAt0Gz+F8oSKYVp7rW9kqdq53N9JTP4hqhyI/G4BPZ6McTBDHirM rktrMl7jIogdj0Dh9FrAqMC4Bo2ceqPV078ywcEunfpabM0qlBauViYWsTWuABvh7A XPfl9aY0Cq7QvX1ygzaUcMxMnh/4W435pqmNcHyMA0qFDIrmNGK+TdxcilvHsscTWr xL9BQfwEKpBjQ== Subject: Re: [PATCH 4/4] net: use dev_err_probe() for MDIO bus registration errors From: netdev-bot+sashiko@kernel.org To: 18255117159@163.com Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, netdev@vger.kernel.org Date: Tue, 01 Dec 2026 02:46:34 +0000 Message-ID: <179609319455.3146.5862482102202898960@kernel.org> In-Reply-To: <20261130023745.820141-5-18255117159@163.com> References: <20261130023745.820141-5-18255117159@163.com> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider. Critical: 0 · High: 1 · Medium: 1 · Low: 2 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). - [High] Eight converted call sites pass the net_device's embedded struct device to dev_err_probe(): &netdev->dev, &ndev->dev, &tc6->netdev->dev… - [Medium] The commit message says these callers already propagate -EPROBE_DEFER, and that is the reason it gives for demoting the… - [Low] The commit message calls the conversion 'mechanical' and says it only suppresses messages for deferred probes. - [Low] In thunder_mdiobus_pci_probe() the converted dev_err_probe(&pdev->dev, err, ...) allocates a deferred_probe_reason… -- net: use dev_err_probe() for MDIO bus registration errors This converts the MDIO bus registration error messages in a number of networking drivers from dev_err(), netdev_err() and dev_warn() to dev_err_probe(). The goal is to suppress the message when registration returns -EPROBE_DEFER. The return paths are meant to stay the same. > diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c > index 9eed0be4411e4..0c72b137c6148 100644 > --- a/drivers/net/ethernet/altera/altera_tse_main.c > +++ b/drivers/net/ethernet/altera/altera_tse_main.c > @@ -157,8 +157,8 @@ static int altera_tse_mdio_create(struct net_device *dev, unsigned int id) > > ret = of_mdiobus_register(mdio, mdio_node); > if (ret != 0) { > - netdev_err(dev, "Cannot register MDIO bus %s\n", > - mdio->id); > + dev_err_probe(&dev->dev, ret, "Cannot register MDIO bus %s\n", > + mdio->id); [Severity: High] Is &dev->dev safe to pass to dev_err_probe() at this point? altera_tse_probe() reaches altera_tse_mdio_create() through altera_tse_phy_get_addr_mdio_create(), before register_netdev() is called. The net_device's embedded struct device only goes through device_initialize() and device_add() in netdev_register_kobject(), so dev->dev.p is still NULL here. of_mdiobus_register() can return -EPROBE_DEFER. One way is the reset GPIO lookup in __mdiobus_register(). Another is fwnode_mdiobus_phy_device_register() when the PHY interrupt provider hasn't probed yet. In that case the call chain is: dev_err_probe() __dev_probe_failed() device_set_deferred_probe_reason() mutex_lock(&deferred_probe_mutex); __device_set_deferred_probe_reason() kfree(dev->p->deferred_probe_reason); Can this dereference the NULL dev->p while the global deferred_probe_mutex is held? If so, the mutex is never released, and every later deferred probe on the system would block on it. The old netdev_err() only printed and never touched dev->p. These other converted sites use the same pattern, and all of them run before the net_device is registered: ethoc_probe(): &netdev->dev oa_tc6_mdiobus_register(): &tc6->netdev->dev, reached through oa_tc6_init() from the lan865x and adin1140 probe paths sxgbe_mdio_register(): &ndev->dev ax88772_init_mdio(), ax88172a_init_mdio(), lan78xx_mdio_init(), smsc95xx_bind(): &dev->net->dev, called from the usbnet bind callback before register_netdev() in usbnet_probe() The USB drivers would hit this on hot-plug. Would it work to pass the parent or bus device at these sites, for example &pdev->dev, &spi->dev, &intf->dev or dev->net->dev.parent? The other option is to keep netdev_err() there. > goto out_free_mdio; > } > of_node_put(mdio_node); > diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c > index 95827df4cf6a1..09dbeb6d29db1 100644 > --- a/drivers/net/ethernet/broadcom/tg3.c > +++ b/drivers/net/ethernet/broadcom/tg3.c > @@ -1557,7 +1557,7 @@ static int tg3_mdio_init(struct tg3 *tp) > > i = mdiobus_register(tp->mdio_bus); > if (i) { > - dev_warn(&tp->pdev->dev, "mdiobus_reg failed (0x%x)\n", i); > + dev_err_probe(&tp->pdev->dev, i, "mdiobus_reg failed\n"); [Severity: Low] This isn't a bug, but the commit message says: Convert the networking callers to dev_err_probe() so the message is suppressed for deferred probes. This is a mechanical change and does not alter the return path. In tg3_mdio_init() the log level goes up from dev_warn to dev_err. The "(0x%x)" errno output is also replaced by the "error %pe:" prefix from __dev_probe_failed(). __dev_probe_failed() also prints nothing for -ENOMEM: case -ENOMEM: /* Don't print anything on -ENOMEM, there's already enough output */ break; That makes -ENOMEM failures from MDIO registration silent at all the converted sites, not only -EPROBE_DEFER. Could the commit message mention these changes? > mdiobus_free(tp->mdio_bus); > return i; > } [ ... ] > diff --git a/drivers/net/mdio/mdio-thunder.c b/drivers/net/mdio/mdio-thunder.c > index aea067658de2d..a77381f84e871 100644 > --- a/drivers/net/mdio/mdio-thunder.c > +++ b/drivers/net/mdio/mdio-thunder.c > @@ -99,7 +99,7 @@ static int thunder_mdiobus_pci_probe(struct pci_dev *pdev, > > err = of_mdiobus_register(bus->mii_bus, node); > if (err) > - dev_err(&pdev->dev, "of_mdiobus_register failed\n"); > + dev_err_probe(&pdev->dev, err, "of_mdiobus_register failed\n"); [Severity: Medium] The commit message says: When __mdiobus_register() returns -EPROBE_DEFER, these callers already propagate the error Does that hold for thunder_mdiobus_pci_probe()? The error from of_mdiobus_register() is dropped here. The loop continues and the probe returns 0: err = of_mdiobus_register(bus->mii_bus, node); if (err) dev_err_probe(&pdev->dev, err, ...); ... } return 0; On -EPROBE_DEFER, dev_err_probe() now only logs at dev_dbg() level, but the bus is never retried. The failure is silent at default log levels, where the old dev_err() printed it. altera_tse_mdio_create() has a similar problem. Its caller, altera_tse_phy_get_addr_mdio_create(), does this: ret = altera_tse_mdio_create(dev, atomic_add_return(1, &instance_count)); if (ret) return -ENODEV; so -EPROBE_DEFER turns into a permanent -ENODEV probe failure, and the message that explained it is now hidden. [Severity: Low] Does this also leak the deferred probe reason string for pdev->dev? On -EPROBE_DEFER, dev_err_probe() calls device_set_deferred_probe_reason(), which allocates dev->p->deferred_probe_reason with kasprintf(). thunder_mdiobus_pci_probe() then returns 0, so the device is never put on the deferred list. That means driver_deferred_probe_del() never clears the reason: if (!list_empty(&dev->p->deferred_probe)) { dev_dbg(dev, "Removed from deferred list\n"); list_del_init(&dev->p->deferred_probe); __device_set_deferred_probe_reason(dev, NULL); } device_release() later frees dev->p with kfree(p) without freeing p->deferred_probe_reason. The old dev_err() didn't allocate anything. > > dev_info(&pdev->dev, "Added bus at %llx\n", r.start); > if (i >= ARRAY_SIZE(nexus->buses)) [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130023745.820141-1-18255117159%40163.com