[net-next,6/6] net: dsa: microchip: add dev_err_probe in probe functions

Message ID 20221102041058.128779-7-rakesh.sankaranarayanan@microchip.com
State New
Headers
Series net: dsa: microchip: regmap range validation and ksz_pwrite status check for lan937x and irq and error checking updates for ksz series |

Commit Message

Rakesh Sankaranarayanan Nov. 2, 2022, 4:10 a.m. UTC
  Probe functions uses normal dev_err() to check error conditions
and print messages. Replace dev_err() with dev_err_probe() to
have more standardized format and error logging.

Signed-off-by: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
---
 drivers/net/dsa/microchip/ksz8863_smi.c | 9 ++++-----
 drivers/net/dsa/microchip/ksz9477_i2c.c | 8 +++-----
 drivers/net/dsa/microchip/ksz_spi.c     | 8 +++-----
 3 files changed, 10 insertions(+), 15 deletions(-)
  

Comments

Jakub Kicinski Nov. 3, 2022, 3:50 a.m. UTC | #1
On Wed, 2 Nov 2022 09:40:58 +0530 Rakesh Sankaranarayanan wrote:
> +			return dev_err_probe(&mdiodev->dev,
> +					     PTR_ERR(dev->regmap[i])
> +					     "Failed to initialize regmap%i\n",
> +					     ksz8863_regmap_config[i].val_bits);
>  		}

Does not build.
  
Rakesh Sankaranarayanan Nov. 3, 2022, 8:55 a.m. UTC | #2
On Wed, 2022-11-02 at 20:50 -0700, Jakub Kicinski wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> On Wed, 2 Nov 2022 09:40:58 +0530 Rakesh Sankaranarayanan wrote:
> > +                     return dev_err_probe(&mdiodev->dev,
> > +                                          PTR_ERR(dev->regmap[i])
> > +                                          "Failed to initialize
> > regmap%i\n",
> > +                                         
> > ksz8863_regmap_config[i].val_bits);
> >               }
> 
> Does not build.

Hi Jakub,

Really sorry that, this file skipped during my build due to config
issues on buildroot, and my build didn't reported the error. Realised
this error after submission and getting status on patchwork.

I understood the mistake and will make resolution in v2 version of
series.

Thanks,
Rakesh S
  

Patch

diff --git a/drivers/net/dsa/microchip/ksz8863_smi.c b/drivers/net/dsa/microchip/ksz8863_smi.c
index ddb40838181e..9e49c2cc0550 100644
--- a/drivers/net/dsa/microchip/ksz8863_smi.c
+++ b/drivers/net/dsa/microchip/ksz8863_smi.c
@@ -152,11 +152,10 @@  static int ksz8863_smi_probe(struct mdio_device *mdiodev)
 						  &regmap_smi[i], dev,
 						  &rc);
 		if (IS_ERR(dev->regmap[i])) {
-			ret = PTR_ERR(dev->regmap[i]);
-			dev_err(&mdiodev->dev,
-				"Failed to initialize regmap%i: %d\n",
-				ksz8863_regmap_config[i].val_bits, ret);
-			return ret;
+			return dev_err_probe(&mdiodev->dev,
+					     PTR_ERR(dev->regmap[i])
+					     "Failed to initialize regmap%i\n",
+					     ksz8863_regmap_config[i].val_bits);
 		}
 	}
 
diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c b/drivers/net/dsa/microchip/ksz9477_i2c.c
index caa9acf1495c..db4aec0a51dc 100644
--- a/drivers/net/dsa/microchip/ksz9477_i2c.c
+++ b/drivers/net/dsa/microchip/ksz9477_i2c.c
@@ -30,11 +30,9 @@  static int ksz9477_i2c_probe(struct i2c_client *i2c,
 		rc.lock_arg = &dev->regmap_mutex;
 		dev->regmap[i] = devm_regmap_init_i2c(i2c, &rc);
 		if (IS_ERR(dev->regmap[i])) {
-			ret = PTR_ERR(dev->regmap[i]);
-			dev_err(&i2c->dev,
-				"Failed to initialize regmap%i: %d\n",
-				ksz9477_regmap_config[i].val_bits, ret);
-			return ret;
+			return dev_err_probe(&i2c->dev, PTR_ERR(dev->regmap[i]),
+					     "Failed to initialize regmap%i\n",
+					     ksz9477_regmap_config[i].val_bits);
 		}
 	}
 
diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c
index 4f2186779082..96c52e8fb51b 100644
--- a/drivers/net/dsa/microchip/ksz_spi.c
+++ b/drivers/net/dsa/microchip/ksz_spi.c
@@ -71,11 +71,9 @@  static int ksz_spi_probe(struct spi_device *spi)
 		dev->regmap[i] = devm_regmap_init_spi(spi, &rc);
 
 		if (IS_ERR(dev->regmap[i])) {
-			ret = PTR_ERR(dev->regmap[i]);
-			dev_err(&spi->dev,
-				"Failed to initialize regmap%i: %d\n",
-				regmap_config[i].val_bits, ret);
-			return ret;
+			return dev_err_probe(&spi->dev, PTR_ERR(dev->regmap[i]),
+					     "Failed to initialize regmap%i\n",
+					     regmap_config[i].val_bits);
 		}
 	}