Article View: linux.kernel.netdev
Article #26641Re: [PATCH v2 3/3] net: use dev_err_probe() for MDIO bus registration errors
From: netdev-bot+sashiko
Date: Fri, 04 Dec 2026 01:23
Date: Fri, 04 Dec 2026 01:23
282 lines
19045 bytes
19045 bytes
Thank you for your contribution! Sashiko AI review found 6 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 4 · 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).
- [Medium] The commit message says the patch stops callers that propagate
the error from printing a misleading message on every -EPROBE_DEFER.
- [Medium] The patch converts xemaclite_mdio_setup() to dev_err_probe(),
but its only caller, xemaclite_of_probe(), ignores the return value:…
- [Medium] eth: fbnic: dev_err_probe() in fbnic_mdiobus_create() with
dropped error
- [Medium] net: hns3: dev_err_probe() in hclge_mac_mdio_config() outside
probe
- [Low] rtl83xx_setup_user_mdio() is a shared helper, and this patch
converted its error print to dev_err_probe().
- [Low] Several converted DSA call sites run from ds->ops->setup rather
than from their own device's probe: mv88e6xxx_mdio_register() via…
--
net: use dev_err_probe() for MDIO bus registration errors
This converts the error prints after mdiobus_register(),
of_mdiobus_register() and devm_mdiobus_register() in many network
drivers to dev_err_probe(). The goal is that -EPROBE_DEFER no longer
produces an error-level message on every deferral. Callers that run
before netdev registration, or that drop the error, are meant to keep
their existing prints.
> net: use dev_err_probe() for MDIO bus registration errors
>
> Several callers of mdiobus_register(), of_mdiobus_register() and
> devm_mdiobus_register() log the error with dev_err()/netdev_err() or
> similar. When __mdiobus_register() returns -EPROBE_DEFER, the callers
> that propagate the error would otherwise print a misleading message on
> every defer.
[Severity: Medium]
Is this goal met for all the helpers converted here? Several of them are
wrapped by a caller that prints its own unconditional dev_err() when the
helper fails. A deferred probe therefore still logs at error level on
every retry, and only the inner, more detailed message is silenced.
The ksz_mdio_register() callers are ksz8463_setup() and ksz8_setup() in
ksz8.c, and ksz9477_setup() in ksz9477.c:
ret = ksz_mdio_register(dev);
if (ret < 0) {
dev_err(dev->dev, "failed to register the mdio");
lan937x_setup() does the same after lan937x_mdio_register().
rtl8365mb_setup() after rtl83xx_setup_user_mdio():
ret = rtl83xx_setup_user_mdio(ds);
if (ret) {
dev_err(priv->dev, "could not set up MDIO bus\n");
mlxbf_gige_probe() after mlxbf_gige_mdio_probe(), which also prints the
-EPROBE_DEFER value:
dev_err(priv->dev, "probe: mdio_probe failed: %pe\n", ERR_PTR(err));
spl2sw_probe() after spl2sw_mdio_init():
dev_err(&pdev->dev, "Failed to initialize mdio bus!\n");
tn40_probe() after tn40_mdiobus_init():
dev_err(&pdev->dev, "failed to initialize mdio bus.\n");
-EPROBE_DEFER can reach these callers in two ways:
- ksz_mdio_register() returns it when of_mdio_find_bus() fails.
- __mdiobus_register() returns it when devm_gpiod_get_optional(&bus->dev,
"reset") defers, for a DT bus whose GPIO provider has not probed yet.
For OF buses, __of_mdiobus_register() also passes through child PHY
registration errors other than -ENODEV.
Should these outer dev_err() calls be converted to dev_err_probe() as
well, or dropped now that the helper reports the error?
[ ... ]
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index 425fd2d22c289..bbbe524016077 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -3896,7 +3896,7 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
>
> err = of_mdiobus_register(bus, np);
> if (err) {
> - dev_err(chip->dev, "Cannot register MDIO bus (%d)\n", err);
> + dev_err_probe(chip->dev, err, "Cannot register MDIO bus\n");
> mv88e6xxx_g2_irq_mdio_free(chip, bus);
> goto out;
> }
[Severity: Medium]
The commit message says callers that "drop the error and continue"
keep their existing dev_err() calls. Isn't fbnic_mdiobus_create() one
of those? Its only caller, fbnic_probe(), does not propagate the
error:
if (fbnic_mdiobus_create(fbd))
goto init_failure_mode;
and init_failure_mode always returns 0, so that devlink stays
registered for firmware updates:
init_failure_mode:
dev_warn(&pdev->dev, "Probe error encountered, entering init ...");
...
return 0;
A deferral here therefore never leads to a retry. With dev_err_probe(),
an -EPROBE_DEFER from devm_mdiobus_register() is logged only at debug
level, and -ENOMEM is not logged at all. That leaves only the generic
init failure mode warning, with nothing saying that the MDIO bus is
the reason networking is unavailable. The old message also printed the
errno, which is now gone for those cases.
On -EPROBE_DEFER, dev_err_probe() also kasprintf()s a reason into
fbd->dev->p->deferred_probe_reason. fbnic_probe() returns 0, so the
device is never on the deferred list and driver_deferred_probe_del()
never clears the reason. device_release() does not free it either, so
the string leaks.
Should fbnic_mdiobus_create() keep dev_err() with the errno, in line
with the exclusion described in the commit message?
[Severity: Low]
Does dev_err_probe() attach the deferral reason to the right device
here? mv88e6xxx_mdio_register() runs from mv88e6xxx_setup(), which is
ds->ops->setup, not from the probe of chip->dev itself.
The same applies to ksz_mdio_register(), lan937x_mdio_register(),
mt7530_setup_mdio(), vsc9959_mdio_bus_alloc(), vsc9953_mdio_bus_alloc()
and rtl83xx_setup_user_mdio().
In a multi-switch DSA tree, dsa_tree_setup() runs setup for every switch
from the probe of whichever switch completes the tree last:
dsa_switch_probe(B)
dsa_tree_setup()
A's ds->ops->setup()
dev_err_probe(A's dev, -EPROBE_DEFER, ...)
The driver core defers only B, but device_set_deferred_probe_reason()
kasprintf()s a reason string onto the private data of A's device. A is
never on the deferred list, so driver_deferred_probe_del() never clears
the string. device_release() also frees the device private data without
freeing deferred_probe_reason.
Each retry frees the previous string before storing a new one, but the
last string is leaked. devices_deferred also shows B with no reason,
while the reason is stored on A.
[ ... ]
> diff --git a/drivers/net/dsa/realtek/rtl83xx.c b/drivers/net/dsa/realtek/rtl83xx.c
> index ad42c05d0a88d..913220827fae7 100644
> --- a/drivers/net/dsa/realtek/rtl83xx.c
> +++ b/drivers/net/dsa/realtek/rtl83xx.c
> @@ -120,8 +120,8 @@ int rtl83xx_setup_user_mdio(struct dsa_switch *ds)
>
> ret = devm_of_mdiobus_register(priv->dev, bus, mdio_np);
> if (ret) {
> - dev_err(priv->dev, "unable to register MDIO bus %s\n",
> - bus->id);
> + dev_err_probe(priv->dev, ret, "unable to register MDIO bus %s\n",
> + bus->id);
> goto err_put_node;
> }
[Severity: Medium]
Is hclge_mac_mdio_config() always reached from the probe of
mdio_bus->parent? It is called from hclge_init_ae_dev(), which is the
init_ae_dev callback of the hclge ae_algo, and hns3.ko and hclge.ko
are separate modules.
Suppose hns3_probe() runs before hclge.ko is loaded. Then
hnae3_register_ae_dev() only adds the ae_dev to hnae3_ae_dev_list,
and the PCI probe completes. Later, hclge_init() calls
hnae3_register_ae_algo(), which runs init_ae_dev() for the pending
devices from module_init and drops the error:
ret = ae_algo->ops->init_ae_dev(ae_dev);
if (ret) {
dev_err(&ae_dev->pdev->dev,
"init ae_dev error, ret = %d\n", ret);
continue;
}
On that path an -EPROBE_DEFER from mdiobus_register() never leads to
a retry. dev_err_probe() still demotes the message naming the MDIO
bus to debug level, and for -ENOMEM it logs nothing. Only the outer
generic message with the errno remains.
On -EPROBE_DEFER, dev_err_probe() also kasprintf()s a deferred probe
reason onto hdev->pdev->dev. That device is already bound and is never
placed on the deferred list. driver_deferred_probe_del() never clears
the reason and device_release() does not free it, so the string leaks
and never shows up in devices_deferred.
Should this call site keep dev_err(), since hclge_init_ae_dev() is not
guaranteed to run in the probe context of this device?
[Severity: Low]
rtl83xx_setup_user_mdio() is also called from rtl8366rb_setup(), which
turns any failure into -ENODEV:
ret = rtl83xx_setup_user_mdio(ds);
if (ret) {
dev_err(priv->dev, "could not set up MDIO bus\n");
return -ENODEV;
}
Suppose devm_of_mdiobus_register() returns -EPROBE_DEFER, for example
because the reset-gpios provider on the mdio node has not probed yet.
The driver core sees -ENODEV and never retries.
dev_err_probe() now logs the message naming the bus only at debug level.
It also stores a deferred-probe reason on priv->dev. That device is never
on the deferred list, so the reason never appears in devices_deferred.
Could this leave a permanent probe failure with only the generic "could
not set up MDIO bus" line, and nothing showing that a deferral caused it?
The -ENODEV conversion predates this patch, but losing the error-level
message on that path is new.
[ ... ]
> diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> index 4719d40a63ba3..8c24690f26b56 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> @@ -862,7 +862,7 @@ static int xemaclite_mdio_setup(struct net_local *lp, struct device *dev)
> rc = of_mdiobus_register(bus, np);
> of_node_put(np);
> if (rc) {
> - dev_err(dev, "Failed to register mdio bus.\n");
> + dev_err_probe(dev, rc, "Failed to register mdio bus.\n");
> goto err_register;
> }
[Severity: Medium]
The commit message says callers that "drop the error and continue; those
keep their existing dev_err()/netdev_err() calls". However, the only
caller of xemaclite_mdio_setup() ignores its return value:
xemaclite_of_probe() {
...
xemaclite_mdio_setup(lp, &ofdev->dev);
...
}
of_mdiobus_register() can return -EPROBE_DEFER here, either from a
deferred reset GPIO in __mdiobus_register() or from a child PHY
registration in __of_mdiobus_register(). In that case the probe
continues and the netdev is registered without its MDIO bus. The only
error-level message about this is now dev_dbg.
dev_err_probe() also kasprintf()s a reason into
ofdev->dev.p->deferred_probe_reason. The probe succeeds, so the device is
never on the deferred list and driver_deferred_probe_del() never clears
the reason. device_release() does not free it either, so the string
leaks.
Should this call site keep dev_err(), in line with the exclusion
described in the commit message?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201042302.846523-1-18255117159%40163.com
Technical Details
Message-ID:
<179634739656.3146.5446342040655643355@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376948-linux-kernel-netdev=dewy.ruReferences:
<20261201042302.846523-4-18255117159@163.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376948-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v2 3/3] net: use dev_err_probe() for MDIO bus registration errors Date: Fri, 04 Dec 2026 01:23:16 +0000 Organization: Usenet Network Message-ID: <179634739656.3146.5446342040655643355@kernel.org> References: <20261201042302.846523-4-18255117159@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2646566"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:V4qwYvrcV5H9/R3wc8J+eOfJ4JA= sha256:wSKp3zdu2+FqEwspMYuiPuXb9n1lTdAuenrmCcK6Qv4= sha1:nUZoDiJf80JNP5T8p6MEb1N0WyM= sha256:Ciw4TkUvGRx3DB5PUF0UoN1z9tdUPXbKlRhkax0t93Q= 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 C6F64117A8C; Fri, 4 Dec 2026 04:23:35 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.739 X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.24, 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 SzBqTqtft3z4; Fri, 4 Dec 2026 04:23:31 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-376948-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 96494114472; Fri, 4 Dec 2026 04:23:22 +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 23B1F6016E4; Fri, 4 Dec 2026 01:23:21 +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=1796347398; b=WFZOEoxeVvcsHkIrkWF0L3hKpd+0p+U/+JOvft2UqbzW5yFRcRqXBX6QzkSpTIqy5uV5 dWZxpSU/ma+cjBVq3JLbm7lCjz6FFT4Txu3qQ9o8jyyOduwfUnFz2f9rq4TIvEvKm/r9Y QhR3ynKL7ZhJ9KIQYY3t9cY6zPQoZWPVGL1oG3ofiWw6DCzM1LLJKqR//tiM8hJKRhCSX b9TMo9HEs5jenQmQip9BE2uHb8ULDKv7hfFI8aQbpyxn5z3JdCJASHul0/Qzr8Sh6Qouu yTs5cUpaICd8Fmpbc/pLz5g0QE3MkZgyDWtSW9wYssjt0Ely6epb7ueXGREgn6BVTFw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796347398; 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=c6iXZTbIGwPnr8nrsDrdbA0jTMs0w8KQiV3Lmg/N1xg=; b=m8X9ePnj6O2TQDGXPsfeohrraXOUFkSyHLYkWBWF5++gox3o0ModJGWJL97f3/t0U44S RrMWOepbcjYHAEqPm168raigZ9LT+5MWT7tfNGiLKeUKDgWIU6BAzd1HOMW65bEXpe28Z 6Z+nsHbN1ffV/vw73k+R/OXWgoA/ezurXFc0CWbXK2reMoaiS6p6OY1F7kH/kj4fxT3Ea t2d9LscdMSgikuPveReFBA07pc5w105Ry/unEzt0PwXB/cJLtVCW55x1gh/UkesPikHTx QHVwHRaYEA0G9HuOQRTdUTlGmW7By80syegRnwq5Wpmz+NlhleSZJtCwLdySScBiPUQ== 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=PBn9DFE0; 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 A2C59606A333; Fri, 4 Dec 2026 01:23:18 +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=PBn9DFE0 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=1796347397; b=VGeNWjedJMnlhe8Fm8r7W3rULfOkoT0MzYkOQ+tm4I+hooBgV/ofPUuQiG0Y8wVT10FT /LWceCco8lxijKrep0gpilJEqUP7RnW0blzsjJJ1+vciEZEvUg/UUU1gmjg61dSwZqwhf 6wFC2T7Z8u8F1sZw6uGecYmZ5HKv5tNcGuJ8eBJDeMvXraMk8RlW7AYt8JhxWjJc8aIZU UQnjp8yfXsU2OxUdexStyVaEQbq9E5Ro+PCFrcyYwl2ord53rBHGCrxWYLeg0OuCNpOYi v1LU+pDw1LZIQNeiV2yu2pQ6HGwNNPxEpFZWUNeWjPw6Ct0qrsu/IBIpI579wTtwtSQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796347397; 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=c6iXZTbIGwPnr8nrsDrdbA0jTMs0w8KQiV3Lmg/N1xg=; b=nIhFkqkv/xcdG09mGUHOBOmwsTpUwKymUfYPyBUKKSa+PIVKweYRkswtjSTrqwdcI0k5 qBYGjz4IdbQdXNrFdUxnXSjcERmzHcjpva14GixA8u8bPmngHpbqBbTbLClKRCGkr8yPx 9siKK2lEzRO8ygFD1ZthbrJZmHVm2BBS4JgZXbCqcGxiEZnrL/NPZI/2zHncMkgEZJJNz L4H/5JX+mQH7Bk0KjbZ3eoawwKNw6h3OSnEE2toOELnOURjIK77o75suU4oXpUS5f4uog EZWUaQkCh5PpFUVztHrbVdVQG8yJTp8kUYv4qMLxgBjlnq5imMFm3eBnO9xhlX4rhKg== 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=PBn9DFE0; 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 BFC40606A32C for <netdev@vger.kernel.org>; Fri, 4 Dec 2026 01:23:17 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 192FB1F000C2; Fri, 4 Dec 2026 01:23:17 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796347397; bh=c6iXZTbIGwPnr8nrsDrdbA0jTMs0w8KQiV3Lmg/N1xg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=PBn9DFE03YkoSH+dmMo0kKjcacjNmabufpUpegMdvTDR6FyjR5QSpOV9aR4+6978e ar0msw5teKGF41Le00JW/ozN347M0bE9RZnSoXx6XQV6b3wI4BA4yhWim7JvCC0FmM 85bw+NL0BJZknqLotMtlVTLMVrmQOyBNIHNp7ouT2dW09knASQ8h3Vk6BkO8R9OcKW PEyqZt8YiQhW0NndcyAosHRa8pHOjJcwbFREG8/OrwmKZ2DCFZOncY4PJ7WCSQMUm0 XcZvk9WwxWppqTyeHGIlErqAJVXElZ+drIJ5b1xDxK8oaCOhpbyNU8Yy6l1yymMJDg UNlGwfnYGk5UQ== X-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 X-In-Reply-To: <20261201042302.846523-4-18255117159@163.com> 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