Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v1] ice: use dev_err_probe in all appropriate places in ice_probe()
@ 2026-06-30  3:25 Rongguang Wei
  2026-06-30  3:43 ` Przemek Kitszel
  2026-06-30  9:40 ` [Intel-wired-lan] " Loktionov, Aleksandr
  0 siblings, 2 replies; 3+ messages in thread
From: Rongguang Wei @ 2026-06-30  3:25 UTC (permalink / raw)
  To: netdev, intel-wired-lan
  Cc: anthony.l.nguyen, przemyslaw.kitszel, andrew+netdev,
	Rongguang Wei

From: Rongguang Wei <weirongguang@kylinos.cn>

Use dev_err_probe() can conveniently combines printing
an error message with returning the errno and also
simplify the code.

Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 24 ++++++++---------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index e2fbe111f849..81959eaec708 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -5167,10 +5167,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
 	struct ice_hw *hw;
 	int err;
 
-	if (pdev->is_virtfn) {
-		dev_err(dev, "can't probe a virtual function\n");
-		return -EINVAL;
-	}
+	if (pdev->is_virtfn)
+		return dev_err_probe(dev, -EINVAL, "can't probe a virtual function\n");
 
 	/* when under a kdump kernel initiate a reset before enabling the
 	 * device in order to clear out any pending DMA transactions. These
@@ -5194,10 +5192,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
 		return err;
 
 	err = pcim_iomap_regions(pdev, BIT(ICE_BAR0), dev_driver_string(dev));
-	if (err) {
-		dev_err(dev, "BAR0 I/O map error %d\n", err);
-		return err;
-	}
+	if (err)
+		return dev_err_probe(dev, err, "BAR0 I/O map error %d\n", err);
 
 	pf = ice_allocate_pf(dev);
 	if (!pf)
@@ -5208,10 +5204,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
 
 	/* set up for high or low DMA */
 	err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
-	if (err) {
-		dev_err(dev, "DMA configuration failed: 0x%x\n", err);
-		return err;
-	}
+	if (err)
+		return dev_err_probe(dev, err, "DMA configuration failed: 0x%x\n", err);
 
 	pci_set_master(pdev);
 	pf->pdev = pdev;
@@ -5246,10 +5240,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
 		return ice_probe_recovery_mode(pf);
 
 	err = ice_init_hw(hw);
-	if (err) {
-		dev_err(dev, "ice_init_hw failed: %d\n", err);
-		return err;
-	}
+	if (err)
+		return dev_err_probe(dev, err, "ice_init_hw failed: %d\n", err);
 
 	ice_init_dev_hw(pf);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v1] ice: use dev_err_probe in all appropriate places in ice_probe()
  2026-06-30  3:25 [PATCH net-next v1] ice: use dev_err_probe in all appropriate places in ice_probe() Rongguang Wei
@ 2026-06-30  3:43 ` Przemek Kitszel
  2026-06-30  9:40 ` [Intel-wired-lan] " Loktionov, Aleksandr
  1 sibling, 0 replies; 3+ messages in thread
From: Przemek Kitszel @ 2026-06-30  3:43 UTC (permalink / raw)
  To: Rongguang Wei, intel-wired-lan
  Cc: anthony.l.nguyen, andrew+netdev, netdev, Rongguang Wei

On 6/30/26 05:25, Rongguang Wei wrote:
> From: Rongguang Wei <weirongguang@kylinos.cn>
> 
> Use dev_err_probe() can conveniently combines printing

s/combines/combine/
you could also wrap at 75 chars, to have better formatting.

> an error message with returning the errno and also
> simplify the code.
> 
> Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>

thank you,
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

> ---
>   drivers/net/ethernet/intel/ice/ice_main.c | 24 ++++++++---------------
>   1 file changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index e2fbe111f849..81959eaec708 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -5167,10 +5167,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
>   	struct ice_hw *hw;
>   	int err;
>   
> -	if (pdev->is_virtfn) {
> -		dev_err(dev, "can't probe a virtual function\n");
> -		return -EINVAL;
> -	}
> +	if (pdev->is_virtfn)
> +		return dev_err_probe(dev, -EINVAL, "can't probe a virtual function\n");
>   
>   	/* when under a kdump kernel initiate a reset before enabling the
>   	 * device in order to clear out any pending DMA transactions. These
> @@ -5194,10 +5192,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
>   		return err;
>   
>   	err = pcim_iomap_regions(pdev, BIT(ICE_BAR0), dev_driver_string(dev));
> -	if (err) {
> -		dev_err(dev, "BAR0 I/O map error %d\n", err);
> -		return err;
> -	}
> +	if (err)
> +		return dev_err_probe(dev, err, "BAR0 I/O map error %d\n", err);
>   
>   	pf = ice_allocate_pf(dev);
>   	if (!pf)
> @@ -5208,10 +5204,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
>   
>   	/* set up for high or low DMA */
>   	err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
> -	if (err) {
> -		dev_err(dev, "DMA configuration failed: 0x%x\n", err);
> -		return err;
> -	}
> +	if (err)
> +		return dev_err_probe(dev, err, "DMA configuration failed: 0x%x\n", err);
>   
>   	pci_set_master(pdev);
>   	pf->pdev = pdev;
> @@ -5246,10 +5240,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)
>   		return ice_probe_recovery_mode(pf);
>   
>   	err = ice_init_hw(hw);
> -	if (err) {
> -		dev_err(dev, "ice_init_hw failed: %d\n", err);
> -		return err;
> -	}
> +	if (err)
> +		return dev_err_probe(dev, err, "ice_init_hw failed: %d\n", err);
>   
>   	ice_init_dev_hw(pf);
>   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Intel-wired-lan] [PATCH net-next v1] ice: use dev_err_probe in all appropriate places in ice_probe()
  2026-06-30  3:25 [PATCH net-next v1] ice: use dev_err_probe in all appropriate places in ice_probe() Rongguang Wei
  2026-06-30  3:43 ` Przemek Kitszel
@ 2026-06-30  9:40 ` Loktionov, Aleksandr
  1 sibling, 0 replies; 3+ messages in thread
From: Loktionov, Aleksandr @ 2026-06-30  9:40 UTC (permalink / raw)
  To: Rongguang Wei, netdev@vger.kernel.org,
	intel-wired-lan@lists.osuosl.org
  Cc: Nguyen, Anthony L, Kitszel, Przemyslaw, andrew+netdev@lunn.ch,
	Rongguang Wei



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Rongguang Wei
> Sent: Tuesday, June 30, 2026 5:26 AM
> To: netdev@vger.kernel.org; intel-wired-lan@lists.osuosl.org
> Cc: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; andrew+netdev@lunn.ch;
> Rongguang Wei <weirongguang@kylinos.cn>
> Subject: [Intel-wired-lan] [PATCH net-next v1] ice: use dev_err_probe
> in all appropriate places in ice_probe()
> 
> From: Rongguang Wei <weirongguang@kylinos.cn>
> 
> Use dev_err_probe() can conveniently combines printing an error
> message with returning the errno and also simplify the code.
> 
I'd recommend to fix the commit message, like: 

ice: use dev_err_probe() in ice_probe()

dev_err_probe() logs the error and returns the supplied error code, which
allows probe error paths to be written more compactly.

Use dev_err_probe() in ice_probe() for error paths that currently print an
error message and immediately return the same error code. This keeps the
existing error handling semantics while reducing open-coded logging and
return sequences.


With the best regards
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

> Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 24 ++++++++--------------
> -
>  1 file changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index e2fbe111f849..81959eaec708 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -5167,10 +5167,8 @@ ice_probe(struct pci_dev *pdev, const struct
> pci_device_id __always_unused *ent)
>  	struct ice_hw *hw;
>  	int err;
> 
> -	if (pdev->is_virtfn) {
> -		dev_err(dev, "can't probe a virtual function\n");
> -		return -EINVAL;
> -	}
> +	if (pdev->is_virtfn)
> +		return dev_err_probe(dev, -EINVAL, "can't probe a
> virtual
> +function\n");
> 
>  	/* when under a kdump kernel initiate a reset before enabling
> the
>  	 * device in order to clear out any pending DMA transactions.
> These @@ -5194,10 +5192,8 @@ ice_probe(struct pci_dev *pdev, const
> struct pci_device_id __always_unused *ent)
>  		return err;
> 
>  	err = pcim_iomap_regions(pdev, BIT(ICE_BAR0),
> dev_driver_string(dev));
> -	if (err) {
> -		dev_err(dev, "BAR0 I/O map error %d\n", err);
> -		return err;
> -	}
> +	if (err)
> +		return dev_err_probe(dev, err, "BAR0 I/O map error
> %d\n", err);
> 
>  	pf = ice_allocate_pf(dev);
>  	if (!pf)
> @@ -5208,10 +5204,8 @@ ice_probe(struct pci_dev *pdev, const struct
> pci_device_id __always_unused *ent)
> 
>  	/* set up for high or low DMA */
>  	err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
> -	if (err) {
> -		dev_err(dev, "DMA configuration failed: 0x%x\n", err);
> -		return err;
> -	}
> +	if (err)
> +		return dev_err_probe(dev, err, "DMA configuration
> failed: 0x%x\n",
> +err);
> 
>  	pci_set_master(pdev);
>  	pf->pdev = pdev;
> @@ -5246,10 +5240,8 @@ ice_probe(struct pci_dev *pdev, const struct
> pci_device_id __always_unused *ent)
>  		return ice_probe_recovery_mode(pf);
> 
>  	err = ice_init_hw(hw);
> -	if (err) {
> -		dev_err(dev, "ice_init_hw failed: %d\n", err);
> -		return err;
> -	}
> +	if (err)
> +		return dev_err_probe(dev, err, "ice_init_hw failed:
> %d\n", err);
> 
>  	ice_init_dev_hw(pf);
> 
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-30  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30  3:25 [PATCH net-next v1] ice: use dev_err_probe in all appropriate places in ice_probe() Rongguang Wei
2026-06-30  3:43 ` Przemek Kitszel
2026-06-30  9:40 ` [Intel-wired-lan] " Loktionov, Aleksandr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox