mlxbf_gige: emit messages during open and probe failures
Subsystems (2)
PATCH 1/1 mlxbf_gige: emit messages during open and probe failures
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.
--- .../mellanox/mlxbf_gige/mlxbf_gige_main.c | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c +15 -5
@@ -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;
Signature · 1 line
2.43.2
Quoted 7 lines · David Thompson
The
open()andprobe()functions of themlxbf_gigedriver check for errors during initialization, but do not provide details regarding the errors. Themlxbf_gigedriver should provide error details in the kernel log, noting what step of initialization failed.Signed-off-by David Thompson <[email protected]>
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.
...
From: Simon Horman <[email protected]>
Date: Mon, 16 Jun 2025 14:57:10 +0100
Quoted 9 lines · David Thompson
Quoted 7 lines
The
open()andprobe()functions of themlxbf_gigedriver check for errors during initialization, but do not provide details regarding the errors. Themlxbf_gigedriver should provide error details in the kernel log, noting what step of initialization failed.Signed-off-by David Thompson <[email protected]>
Quoted 8 lines
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 <[email protected]>
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
Simon Horman
reviewerQuoted 19 lines · Alexander Lobakin
From: Simon Horman <[email protected]>
Date: Mon, 16 Jun 2025 14:57:10 +0100Quoted 16 lines · David Thompson
Quoted 7 lines
The
open()andprobe()functions of themlxbf_gigedriver check for errors during initialization, but do not provide details regarding the errors. Themlxbf_gigedriver should provide error details in the kernel log, noting what step of initialization failed.Signed-off-by David Thompson <[email protected]>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.
Quoted 5 lines
Quoted 1 line
Reviewed-by Simon Horman <[email protected]>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?
Quoted 32 lines
-----Original Message-----
From: Simon Horman <[email protected]>
Sent: Monday, June 16, 2025 3:18 PM
To: Alexander Lobakin <[email protected]>
Cc: David Thompson <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Asmaa Mnebhi <[email protected]>; u.kleine- [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net-next v1]mlxbf_gige: emit messages during open and probe failuresQuoted 20 lines · Alexander Lobakin
From: Simon Horman <[email protected]>
Date: Mon, 16 Jun 2025 14:57:10 +0100Quoted 16 lines · David Thompson
Quoted 6 lines
The
open()andprobe()functions of themlxbf_gigedriver check for errors during initialization, but do not provide details regarding the errors. Themlxbf_gigedriver should provide error details in the kernel log, noting what step of initialization failed.Signed-off-by David Thompson <[email protected]>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 <[email protected]>
Quoted 8 lines
Quoted 3 lines
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?
Sorry for late response.
Yes, will look into updating this patch to use %pe
Thanks for the feedback.
Dave
Simon Horman
reviewerQuoted 39 lines · David Thompson
Quoted 39 lines
-----Original Message-----
From: Simon Horman <[email protected]>
Sent: Monday, June 16, 2025 3:18 PM
To: Alexander Lobakin <[email protected]>
Cc: David Thompson <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Asmaa Mnebhi <[email protected]>; u.kleine- [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH net-next v1]mlxbf_gige: emit messages during open and probe failuresQuoted 18 lines · Alexander Lobakin
From: Simon Horman <[email protected]>
Date: Mon, 16 Jun 2025 14:57:10 +0100Quoted 15 lines · David Thompson
Quoted 6 lines
The
open()andprobe()functions of themlxbf_gigedriver check for errors during initialization, but do not provide details regarding the errors. Themlxbf_gigedriver should provide error details in the kernel log, noting what step of initialization failed.Signed-off-by David Thompson <[email protected]>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.Quoted 5 lines
Quoted 1 line
Reviewed-by Simon Horman <[email protected]>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.
Quoted 7 lines
Quoted 1 line
David, could you consider making this so?
Sorry for late response.
Yes, will look into updating this patch to use %pe
Thanks for the feedback.
Thanks, much appreciated.