From: Rongguang Wei <clementwei90@163.com>
To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
aleksandr.loktionov@intel.com, przemyslaw.kitszel@intel.com
Cc: anthony.l.nguyen@intel.com, andrew+netdev@lunn.ch,
Rongguang Wei <weirongguang@kylinos.cn>
Subject: [Intel-wired-lan] [PATCH net-next v2] ice: use dev_err_probe() in ice_probe()
Date: Wed, 1 Jul 2026 09:36:18 +0800 [thread overview]
Message-ID: <20260701013618.29934-1-clementwei90@163.com> (raw)
From: Rongguang Wei <weirongguang@kylinos.cn>
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.
Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
---
v2:
- Fix commit message per Aleksandr Loktionov's recommendation.
v1: https://lore.kernel.org/netdev/20260630032537.42605-1-clementwei90@163.com/T/#t
---
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 e2fd2dab03e3..31aa42f8e6d3 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -5161,10 +5161,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
@@ -5188,10 +5186,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)
@@ -5202,10 +5198,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;
@@ -5240,10 +5234,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
WARNING: multiple messages have this Message-ID (diff)
From: Rongguang Wei <clementwei90@163.com>
To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
aleksandr.loktionov@intel.com, przemyslaw.kitszel@intel.com
Cc: anthony.l.nguyen@intel.com, andrew+netdev@lunn.ch,
Rongguang Wei <weirongguang@kylinos.cn>
Subject: [PATCH net-next v2] ice: use dev_err_probe() in ice_probe()
Date: Wed, 1 Jul 2026 09:36:18 +0800 [thread overview]
Message-ID: <20260701013618.29934-1-clementwei90@163.com> (raw)
From: Rongguang Wei <weirongguang@kylinos.cn>
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.
Signed-off-by: Rongguang Wei <weirongguang@kylinos.cn>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
---
v2:
- Fix commit message per Aleksandr Loktionov's recommendation.
v1: https://lore.kernel.org/netdev/20260630032537.42605-1-clementwei90@163.com/T/#t
---
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 e2fd2dab03e3..31aa42f8e6d3 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -5161,10 +5161,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
@@ -5188,10 +5186,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)
@@ -5202,10 +5198,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;
@@ -5240,10 +5234,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
next reply other threads:[~2026-07-01 1:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 1:36 Rongguang Wei [this message]
2026-07-01 1:36 ` [PATCH net-next v2] ice: use dev_err_probe() in ice_probe() Rongguang Wei
2026-07-01 14:37 ` Maciej Fijalkowski
2026-07-01 14:37 ` [Intel-wired-lan] " Maciej Fijalkowski
2026-07-02 7:05 ` weirongguang
2026-07-02 7:05 ` [Intel-wired-lan] " weirongguang
2026-07-02 12:47 ` Przemek Kitszel
2026-07-02 12:47 ` Przemek Kitszel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260701013618.29934-1-clementwei90@163.com \
--to=clementwei90@163.com \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=netdev@vger.kernel.org \
--cc=przemyslaw.kitszel@intel.com \
--cc=weirongguang@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.