.../mellanox/mlxbf_gige/mlxbf_gige_main.c | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
The open() and probe() functions of the mlxbf_gige driver
check for errors during initialization, but do not provide
details regarding the errors. The mlxbf_gige driver should
provide error details in the kernel log, noting what step
of initialization failed.
Signed-off-by: David Thompson <davthompson@nvidia.com>
---
.../mellanox/mlxbf_gige/mlxbf_gige_main.c | 20 ++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
index fb2e5b844c15..ba0ed4170b82 100644
--- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
+++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
@@ -142,8 +142,10 @@ static int mlxbf_gige_open(struct net_device *netdev)
mlxbf_gige_cache_stats(priv);
err = mlxbf_gige_clean_port(priv);
- if (err)
+ if (err) {
+ dev_err(priv->dev, "open: clean_port failed, err=0x%x\n", err);
return err;
+ }
/* Clear driver's valid_polarity to match hardware,
* since the above call to clean_port() resets the
@@ -154,19 +156,25 @@ static int mlxbf_gige_open(struct net_device *netdev)
phy_start(phydev);
err = mlxbf_gige_tx_init(priv);
- if (err)
+ if (err) {
+ dev_err(priv->dev, "open: tx_init failed, err=0x%x\n", err);
goto phy_deinit;
+ }
err = mlxbf_gige_rx_init(priv);
- if (err)
+ if (err) {
+ dev_err(priv->dev, "open: rx_init failed, err=0x%x\n", err);
goto tx_deinit;
+ }
netif_napi_add(netdev, &priv->napi, mlxbf_gige_poll);
napi_enable(&priv->napi);
netif_start_queue(netdev);
err = mlxbf_gige_request_irqs(priv);
- if (err)
+ if (err) {
+ dev_err(priv->dev, "open: request_irqs failed, err=0x%x\n", err);
goto napi_deinit;
+ }
mlxbf_gige_enable_mac_rx_filter(priv, MLXBF_GIGE_BCAST_MAC_FILTER_IDX);
mlxbf_gige_enable_mac_rx_filter(priv, MLXBF_GIGE_LOCAL_MAC_FILTER_IDX);
@@ -418,8 +426,10 @@ static int mlxbf_gige_probe(struct platform_device *pdev)
/* Attach MDIO device */
err = mlxbf_gige_mdio_probe(pdev, priv);
- if (err)
+ if (err) {
+ dev_err(priv->dev, "probe: mdio_probe failed, err=0x%x\n", err);
return err;
+ }
priv->base = base;
priv->llu_base = llu_base;
--
2.43.2
On Fri, Jun 13, 2025 at 05:42:28PM +0000, David Thompson wrote: > The open() and probe() functions of the mlxbf_gige driver > check for errors during initialization, but do not provide > details regarding the errors. The mlxbf_gige driver should > provide error details in the kernel log, noting what step > of initialization failed. > > Signed-off-by: David Thompson <davthompson@nvidia.com> Hi David, I do have some reservations about the value of printing out raw err values. But I also see that the logging added by this patch is consistent with existing code in this driver. So in that context I agree this is appropriate. Reviewed-by: Simon Horman <horms@kernel.org> ...
From: Simon Horman <horms@kernel.org> Date: Mon, 16 Jun 2025 14:57:10 +0100 > On Fri, Jun 13, 2025 at 05:42:28PM +0000, David Thompson wrote: >> The open() and probe() functions of the mlxbf_gige driver >> check for errors during initialization, but do not provide >> details regarding the errors. The mlxbf_gige driver should >> provide error details in the kernel log, noting what step >> of initialization failed. >> >> Signed-off-by: David Thompson <davthompson@nvidia.com> > > Hi David, > > I do have some reservations about the value of printing > out raw err values. But I also see that the logging added > by this patch is consistent with existing code in this driver. > So in that context I agree this is appropriate. > > Reviewed-by: Simon Horman <horms@kernel.org> I still think it's better to encourage people to use %pe for printing error codes. The already existing messages could be improved later, but then at least no new places would sneak in. Thanks, Olek
On Mon, Jun 16, 2025 at 04:06:49PM +0200, Alexander Lobakin wrote: > From: Simon Horman <horms@kernel.org> > Date: Mon, 16 Jun 2025 14:57:10 +0100 > > > On Fri, Jun 13, 2025 at 05:42:28PM +0000, David Thompson wrote: > >> The open() and probe() functions of the mlxbf_gige driver > >> check for errors during initialization, but do not provide > >> details regarding the errors. The mlxbf_gige driver should > >> provide error details in the kernel log, noting what step > >> of initialization failed. > >> > >> Signed-off-by: David Thompson <davthompson@nvidia.com> > > > > Hi David, > > > > I do have some reservations about the value of printing > > out raw err values. But I also see that the logging added > > by this patch is consistent with existing code in this driver. > > So in that context I agree this is appropriate. > > > > Reviewed-by: Simon Horman <horms@kernel.org> > > I still think it's better to encourage people to use %pe for printing > error codes. The already existing messages could be improved later, > but then at least no new places would sneak in. Thanks, I agree that is reasonable. And as a bonus the patch-set could update existing messages. David, could you consider making this so?
© 2016 - 2025 Red Hat, Inc.