Skip to contentSkip to conversation

mlxbf_gige: emit messages during open and probe failures

PATCH Superseded David Thompson 3 participants 6 messages Jun 13, 2025 – Jul 1, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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
index fb2e5b844c15..ba0ed4170b82 100644
@@ -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
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · David Thompson

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.

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.

...

#2 lore raw

From: Simon Horman <[email protected]>
Date: Mon, 16 Jun 2025 14:57:10 +0100

Quoted 9 lines · David Thompson
Quoted 7 lines

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.

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.

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

reviewer
#3 lore raw
Quoted 19 lines · Alexander Lobakin

From: Simon Horman <[email protected]>
Date: Mon, 16 Jun 2025 14:57:10 +0100

Quoted 16 lines · David Thompson
Quoted 7 lines

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.

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

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?

#4 lore raw
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 failures

Quoted 20 lines · Alexander Lobakin

From: Simon Horman <[email protected]>
Date: Mon, 16 Jun 2025 14:57:10 +0100

Quoted 16 lines · David Thompson
Quoted 6 lines

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.

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 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

reviewer
#5 lore raw
Quoted 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 failures

Quoted 18 lines · Alexander Lobakin

From: Simon Horman <[email protected]>
Date: Mon, 16 Jun 2025 14:57:10 +0100

Quoted 15 lines · David Thompson
Quoted 6 lines

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.

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

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.