mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-06 12:44:14 +08:00
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>
This commit is contained in:
parent
3f118c449c
commit
363b65459b
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user