diff options
author | Michael Walle <michael@walle.cc> | 2022-06-22 14:35:43 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2022-06-23 20:52:19 -0700 |
commit | 363b65459b78c0488721196186fac7f48593234e (patch) | |
tree | 9c98a5ad4ce785ea74609f549e391b8628702a97 /drivers/net/phy | |
parent | 3f118c449c8ef7713e9acdebe333d947ab46933b (diff) | |
download | linux-363b65459b78c0488721196186fac7f48593234e.tar.bz2 |
net: phy: nxp-tja11xx: use devm_hwmon_sanitize_name()
Instead of open-coding the bad characters replacement in the hwmon name,
use the new devm_hwmon_sanitize_name().
Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/nxp-tja11xx.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c index 9944cc501806..2a8195c50d14 100644 --- a/drivers/net/phy/nxp-tja11xx.c +++ b/drivers/net/phy/nxp-tja11xx.c @@ -444,15 +444,10 @@ static int tja11xx_hwmon_register(struct phy_device *phydev, struct tja11xx_priv *priv) { struct device *dev = &phydev->mdio.dev; - int i; - - priv->hwmon_name = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL); - if (!priv->hwmon_name) - return -ENOMEM; - for (i = 0; priv->hwmon_name[i]; i++) - if (hwmon_is_bad_char(priv->hwmon_name[i])) - priv->hwmon_name[i] = '_'; + priv->hwmon_name = devm_hwmon_sanitize_name(dev, dev_name(dev)); + if (IS_ERR(priv->hwmon_name)) + return PTR_ERR(priv->hwmon_name); priv->hwmon_dev = devm_hwmon_device_register_with_info(dev, priv->hwmon_name, |